Welcome! Log In Create A New Profile

Advanced

Nginx reverse proxy multi upstream (multiples sites)

April 10, 2015 12:45PM
Hello,

Here is my situation: I will have one frontend server running nginx, and multiple backends servers running apache or tomcat with different applications. I am NOT trying to do any load balancing. What I need to do is setup nginx to proxy connections to specific servers based on a specific IP of nginx.

I'm using the nginx 1.6.1.

I tried the configuration below but I have trouble with the location configuration, I need a dynamic configuration that does not impact the backend servers.



cat nginx.conf :
worker_processes 1;
worker_rlimit_nofile 100000;
error_log logs/error.log warn;
pid /home/nginx/logs/nginx.pid;


events {
worker_connections 10240;
use epoll;
multi_accept on;
}

http{
client_max_body_size 2048m;
include /home/nginx/naxsi/naxsi_config/naxsi_core.rules;
#include /etc/nginx/naxsi.rules;
include /home/nginx/conf/mime.types;
default_type application/octet-stream;
server_tokens off;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main;

include /home/nginx/conf/conf.d/*.conf;
#include /etc/nginx/sites-enabled/*.conf;
}






cat conf.d/combined.conf :

upstream market.cloud.com {
server 10.1.0.16;
server 10.1.0.60 backup;

}


upstream panel.cloud.com {
server 10.1.0.12;
server 10.1.0.51 backup;

}

server {
location / {
proxy_pass http://market.cloud.com;
}
location /panel {
proxy_pass http://panel.cloud.com;
}
}
Subject Author Posted

Nginx reverse proxy multi upstream (multiples sites)

cloud devops April 10, 2015 12:45PM

Re: Nginx reverse proxy multi upstream (multiples sites)

Francis Daly April 10, 2015 05:00PM

Re: Nginx reverse proxy multi upstream (multiples sites)

cloud devops April 10, 2015 05:09PM

Re: Nginx reverse proxy multi upstream (multiples sites)

Francis Daly April 10, 2015 05:24PM

Re: Nginx reverse proxy multi upstream (multiples sites)

cloud devops April 10, 2015 06:29PM

Re: Nginx reverse proxy multi upstream (multiples sites)

Francis Daly April 11, 2015 03:26AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 321
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