1. Type introduction 1.1 Domain-based virtual hosting The so-called domain name-based virtual host means that different virtual hosts are distinguished by different domain names. Domain name-based virtual hosts are the most widely used virtual host type in enterprises. Almost all websites that provide services to the outside world use domain name-based hosts, such as www.test1.com www.test2.com, etc. 1.2 Port-based virtual hosts Similarly, the so-called port-based virtual host means that different virtual hosts are distinguished by different ports. The enterprise applications corresponding to this type of virtual host are mainly internal company websites, such as: some website backends that do not want to provide direct user access to the outside world, etc. To access a port-based virtual host, the address must contain the port number, such as http://www.test.com:81 http://www.test.com:82, etc. 1.3 IP-based virtual hosts Similarly, the so-called IP-based virtual host means distinguishing different virtual hosts by different IPs. Enterprise applications corresponding to such virtual hosts are very rare. Generally, scenarios where different businesses need to use multiple IPs will bind IPs on the load balancing. I do not bind IPs on the web to distinguish different virtual machines. All three types of virtual hosts can be used independently or mixed. 2. Virtual host configuration based on multiple domain names Basic steps: modify the nginx configuration file to configure multiple domain names, restart the nginx service, create corresponding different site directories and upload site files, or use one site directory and access it through multiple domain names 3. Virtual host configuration based on multiple ports Basic steps: modify the nginx configuration file to configure multiple ports, restart the nginx service, modify the security group rules to open ports, create corresponding different site directories and upload site files, or use one site directory and access it through multiple ports 4. Virtual host configuration based on multiple IPs 4.1 Basic steps: add a network card to obtain multiple IPs or add auxiliary IPs, modify the nginx configuration file to configure multiple IPs, restart the nginx service, create corresponding different site directories and upload site files, or use one site directory and access it through multiple IPs 4.2 How to add auxiliary IP 4.2.1 Temporarily add auxiliary IP: Method 1: ifconfig eth0:1 10.0.0.8/24 up Method 2: ip addr ip addr help View help ip addr add 10.0.0.9/24 dev eth0 (use ip addr to view) ip addr add 10.0.0.9/24 label eth0:2 dev eth0 (both ifconfig and ipaddr can be used to view, recommended) 4.2.2 Permanently add auxiliary IP cd /etc/sysconfig/network-scripts/ #Enter the directory of the network card configuration file cp ifcfg-eth0 ifcfg-eth0:1 #Copy the configuration file and rename it vim ifcfg-eth0:1 #Edit the configuration file /etc/init.d/network restart #Restart the network service The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Basic usage knowledge points of mini programs (very comprehensive, recommended!)
>>: MySQL 8.0.12 installation and environment variable configuration tutorial under win10
Table of contents Preface What are asynchronous i...
Today's web designs tend to display very larg...
First: <abbr> or <acronym> These two s...
I will be learning MySQL next semester. I didn...
Introduction Because JavaScript is single-threade...
This article uses examples to illustrate the impa...
Six effectsImplementation Code html <h1>CSS...
This article shares the specific code of JS to ac...
Table of contents Make scrolling smoother BetterS...
Preface How to write efficient SQL statements is ...
Table of contents How to create a Pod? kubectl to...
Table of contents Semaphore Nginx hot deployment ...
Preface During development, we often encounter va...
Table of contents 2. Comma operator 3. JavaScript...
1. Font properties color, specifies the color of ...