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 the reverse proxy of nginx

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces the relevant knowledge of "how to configure the reverse proxy of nginx". The editor shows you the operation process through the actual case. The operation method is simple, fast and practical. I hope this article "how to configure the reverse proxy of nginx" can help you solve the problem.

Reverse proxy of nginx

We have to prepare two test servers, web1 and web2, before configuring the nginx reverse proxy.

1. Install httpd

[root@web1 ~] # yum install-y httpd [root@web2 ~] # yum install-y httpd

two。 Provide test page

[root@web1 ~] # echo "web1.test.com" > / var/www/html/index.html [root@web2 ~] # echo "web2.test.com" > / var/www/html/index.html

3. Start the httpd service

[root@web1 ~] # service httpd start is starting httpd: [OK] [root@web2 ~] # service httpd start is starting httpd: [OK]

4. Test it

5. In a nutshell, forward proxy and reverse proxy

(1)。 The concept of forward agent

The forward agent, that is, the legendary agent, works like a springboard. To put it simply, I am a user, I cannot access a website, but I can access a proxy server, this proxy server, he can access the website that I cannot access, so I first connect to the proxy server and tell him that I need the content that cannot be accessed by the website, and the proxy server goes to get it back. And come back to me. From the point of view of the website, there is only one record when the proxy server comes to pick up the content, sometimes does not know that it is the user's request, and hides the user's information, depending on whether the agent tells the site or not.

The conclusion is that the forward proxy is a server between the client and the original server (origin server). In order to get content from the original server, the client sends a request to the agent and specifies the target (the original server), and then the agent transfers the request to the original server and returns the obtained content to the client. The client must make some special settings to use the forward proxy.

(2)。 The concept of reverse proxy

Continue to give examples:

For example, a user visits http://www.test.com/readme, but there is no readme page on www.test.com. He secretly takes it from another server and returns it to the user as his own content, but the user does not know it. The server corresponding to the domain name www.test.com mentioned here has set up the reverse proxy function.

The conclusion is that the reverse proxy is just the opposite, it is like the original server to the client, and the client does not need to make any special settings. The client sends a normal request to the content in the reverse proxy's namespace (name-space), which then determines where to forward the request (the original server) and returns the obtained content to the client as if it were already its own.

(3)。 The difference between the two

In terms of use:

A typical use of forward proxies is to provide access to internet for LAN clients in firewalls. Forward agents can also use buffering features to reduce network usage. A typical use of a reverse proxy is to provide a server behind a firewall for internet users to access. Reverse proxies can also provide load balancing for multiple servers at the back end, or buffering services for slower servers at the back end. In addition, reverse proxy can also enable advanced url policies and management techniques so that web pages on different web server systems exist in the same url space at the same time.

In terms of security:

The forward agent allows the client to access any website through it and hides the client itself, so you must take security measures to ensure that only authorized clients are served. Reverse proxies are transparent to the outside world, and visitors do not know they are accessing a proxy.

This is the end of the content about "how to configure the reverse proxy of nginx". Thank you for your reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

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

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report