Implementation of Multi-Port Mapping of nginx reverse proxy
Code interpretation
1.1 http:www.baidu.test.com defaults to 80, access "/" makes use of reverse proxy, and then accesses local 8083
8083 represents the local frontend project access address. The frontend needs to access the backend data, "/", and continues to proxy to the backend address 9803.
1.3 this makes it possible to access multiple ports as long as port 80 is opened.
The root configuration can be either an absolute path or a relative path.
Server {listen 80; server_name www.baidu.test.com;# the domain name you want to fill in, separated by commas location / {proxy_pass http://localhost:8083; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; root / app/esop_web/esopschool; index index.html Try_files $uri $uri/ / index.html;} location / rest {proxy_pass http://localhost:9803; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;}}
The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.