Welcome! Log In Create A New Profile

Advanced

proxy server needs to point to two servers

June 29, 2012 02:42PM
Hi all.

Our machines are behind a private firewall. I have a master machine as proxy server so two machines (production and development) can be accessed publicly.

So I can access production as http://public_url/app1, http://public_url/app2, http://pbulic_url/app3
and development as
http://public_url/dev/app1, etc (actually, dev.public_url) would be a better option.

However, with the config below, I cannot access the development machine at all.

This is the site-enabled/default configuration we have on the proxy server

server {
listen 80;
client_max_body_size 200M;
server_name localhost 127.0.0.1;
server_name_in_redirect off;

location / {
proxy_pass http://10.10.0.59;
proxy_redirect default;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

and I want to add a second server block because I need to support development server as well.

My attempt with the second server block...

server {
listen 80;
client_max_body_size 200M;
server_name localhost 127.0.0.1;
server_name_in_redirect off;

location ^~ /dev/ {
proxy_pass http://10.10.0.56;
proxy_redirect default;
rewrite /dev/(.*) /$1 break;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

How can I fix my error? I know I am terrible with nginx configuration... thanks!
Subject Author Posted

proxy server needs to point to two servers

x7311 June 29, 2012 02:42PM

Re: proxy server needs to point to two servers

Francis Daly June 29, 2012 03:52PM

Re: proxy server needs to point to two servers

x7311 June 29, 2012 05:20PM

Re: proxy server needs to point to two servers

Francis Daly June 30, 2012 07:42AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 237
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready