How multiple services in the server share port 80

for the Apache service used by the company in the background, there is now a new nginx proxy static page at the front end, but the listening port 80 always accesses Apache. How to configure nginx so that it can also listen to port 80

Mar.21,2021

to distinguish by domain name, step:

  1. nginx configuration enables server_name
  2. do not directly ip, bind the local host, to a fake domain name when accessing nginx, such as 127.0.0.1 domain.test
-sharp 
server {
     listen       80;
     server_name  domain1.test  www.domain1.test;
     ...
}
...

-sharp 
server {
     listen       80;
     server_name  domain2.test  www.domain2.test;
     ...
}
...
Menu