I'd like to ask you a question about the deployment of nginx.

I would like to ask you that if two projects are deployed in one port of nginx, which project is displayed if you access it with an ip address, and how to set the project displayed by default

Mar.16,2021

Map
both items listen on port 80, and the server_name of the two items is different
when you visit the browser, you must visit server_name instead of the ip+ port number you configured.


  1. A domain name (including ip) + a port can only correspond to one project.
  2. for different projects, either use the domain name (hosts), or use different ports to access.

  1. try not to throw up a question with uncertainty, which can introduce multiples of complexity. For example, for this question alone, asking "how to deploy access from an ip source with nginx" is better than "what happens with ip access after deploying access from a domain name with nginx". The complexity of the former question ends with: "can it be deployed?" -> the two levels of "how to deploy if you can deploy"; the latter needs at least a three-level process of "first describing the phenomenon, then deducing the reason, and finally giving advice", and does not necessarily solve the problem.
  2. The listen instruction of
  3. nginx can directly specify ip, and server_name to specify a domain name, which should be able to meet the needs of two sources. If the browser does not specify a port, the default is 80.
  4. it is not recommended to access ip directly. Unless this ip is a pre-load balancer, it is not very flexible.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e446e8-44aa5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e446e8-44aa5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?