Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Nginx virtual host based on domain name, port, IP address

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report