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

How to configure port mapping in Nginx

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

Share

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

How do I configure port mapping in Nginx? Many novices are not very clear about this. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can gain something.

Nginx Port Mapping configuration

Server {listen 80; server_name rbac.dev-lu.com; # 80 forward to port 8000 location / {proxy_pass http://127.0.0.1:8000;}}

Nginx reverse proxy-multi-port mapping

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;}} is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

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