Nginx reverse proxy multi upstream (multiples sites)
cloud devops
nginx-forum at nginx.us
Fri Apr 10 16:45:21 UTC 2015
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;
}
}
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,257950,257950#msg-257950
More information about the nginx
mailing list