search

Home  >  Q&A  >  body text

Reverse proxy - nginx acts as a secondary proxy

for example:

There is currently an HTTP proxy server A (10.0.0.1/24, 192.168.0.1/24) and a Web server B (192.168.0.2/24).

Machine C (10.0.0.3/24) can access the website on B by setting A as a proxy.

C machine has a public IP. Now you only have permission to make adjustments to C. How to configure nginx installed on C so that it can reverse proxy website B...

为情所困为情所困2783 days ago782

reply all(1)I'll reply

  • 我想大声告诉你

    我想大声告诉你2017-05-16 17:26:41

    Since C and B are not on the same network segment, we can only use A, which is the secondary proxy you mentioned. Since you have implemented A proxy for B, you can set it up in the same way
    Client<===>C<===>A<===>B
    I wrote it down briefly:
    nginx for C

    upstream A{
        server 10.0.0.1:80;
    }
    server {
            listen       80;
            server_name  www.xxxx.com;
    
            location / {
                    proxy_pass  http://A;
            }
    }
    

    A’s nginx

    upstream B{
        server 192.168.0.2:80;
    }
    server {
            listen       80;
            location / {
                    proxy_pass  http://B;
            }
    }
    

    That’s probably it, but I think you may have other needs

    reply
    0
  • Cancelreply