Linux Web server (ii)
1: Build a domain-based virtual host
First, set up a DNS server for two sites, and create a new zone, respectively: Www.goole.com and www.baidu.com
2) Modify the configuration file
3) Modify the data file
4) Restart the DNS service
5) Build Two websites
6: Preparing the Web page
7) Open the virtual host configuration file, modify the configuration file
8: Add the following content
9) Modify the master configuration file to enable the virtual host
vi/usr/local/httpd/conf/httpd.conf, remove the # # from the front.
10) Restart the HTTPD service
11) Accessing the virtual Web host on the client
So far, domain-based virtual hosting has been built.
Note: If you cannot access it on the client, it may be that the server's firewall is open or not, or the DNS service is not restarted, or the HTTPD service may not be restarted.
Case two: Build a virtual host based on different IP
1) Add two addresses to the server
2) Modify the resolved IP address in the DNS data file, Goole using 192.168.1.1,baidu 192.168.1.2
3) The Goole remains unchanged
4) Baidu: The following
5) Modify the virtual host configuration file
6) Restart HTTPD service
7) Clear the DNS cache before accessing website access on the client
8) Accessing the virtual Web host on the client
Case three: Port-based virtual host
1) Change the DNS data file "Goole" and "Baidu" in the IP of two URLs to the same 192.168.1.1
2) Modify the virtual host configuration file
3) Modify the httpd master configuration file vi/usr/local/httpd/conf/httpd.conf
4) Restart the HTTPD service
5) Accessing the virtual Web site on the client
Linux Web server (ii) Web hosting based on domain name, IP, port