Nginx virtual host based on domain name, port, IP address
Article directory 1, Nginx virtual host 2, based on domain name 3, based on port 4, based on IP address 1, Nginx virtual host each virtual web site has an independent "server {}" configuration terminal, the respective listening IP address and port number can be determined separately, of course, the website name is also different. Second, prepare based on the domain name environment: these two domain names point to the same IP address domain name: www.wang.com / www.king.comIP address: the installation of 192.168.111.141nginx has been configured in advance. If you need it, you can read a blog post. 1. DNS parsing
2. Configure the content of the test web page
Change the / usr/local/nginx/conf/nginx.conf file to configure different sites with the server {} section.
4. Check the configuration file for syntax errors
5. Test using client win10 to access two domain names
Third, select different ports in the system based on the port, and map multiple ports to the same IP address. 1. Modify the nginx.conf file
2. Restart nginx
3. Test the content of the web page
4. Test using client win10 to access two ports
Domain name based on IP address: www.king.com / www.wang.comIP address: 192.168.111.141 / 192.168.111.142
1. Modify the nginx.conf file
2. Restart nginx
3. IP address of demo in dns
4. Test using client win10 to access two ip addresses