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 forward port 80 request to port 8080 in nginx reverse proxy

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

How to forward port 80 requests to port 8080 in nginx reverse proxy? Many novices are not very clear about this. In order to help you solve this problem, the following small series will explain it in detail for everyone. Those who have this need can come to learn. I hope you can gain something.

Reverse proxy means that the proxy server (in this case nginx) receives requests on the network, that is, url (default port 80),

1, nginx through some of the url inside the judgment (conveying rules configured in the nginx configuration file), such as port number (nginx default is 80) may be the second level domain name to judge

For example, test1.baidu.com, test2.baidu.com, these are two second-level domain names. The first-level domain name here is baidu.com. DNS will resolve these two domain names to the same ip (you need to add a second-level domain name resolution (Alibaba Cloud needs to add resolution to the domain name resolution, different domain names can be resolved to a unified ip server), or they can be resolved to different ip)

2. After configuring the reverse proxy, nginx can forward requests for different secondary domain names to different ports or ip and ports that can provide corresponding services.

In other words, you enter test1.baidu.com in your browser.

test2.baidu.com and then enter, the actual access port (or ip, depending on the configuration of forwarding rules in nginx) is different, and the service obtained is also different (this is the item on the ip and port that forwards the request according to different domain names or request paths in the configuration file obtained by nginx);

client: client

That blue cloud is the Internet.

Reverse proxy server: server configured with nginx

web server, file server-tomcat for service delivery, or other container (where web projects are deployed), usually in the same local area network

To put it bluntly, that is, the external network accesses the same port (80) and forwards it to different ports providing different services on the internal network through nginx.

Does this mean that port 80 only needs to be opened and 8080 can be closed?

I'll go to Alibaba Cloud to test it:

After closing 8080,

Modify the default.conf file of nginx

wq save modified, from nginx: service nginx restart

Did reading the above help you? If you still want to have further understanding of related knowledge or read more related articles, please pay attention to 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