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

Implementation of Multi-Port Mapping of nginx reverse proxy

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

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.

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