Does the nginx “upstream” directive have a port setting?
Posted
by
orzzzzz
on Server Fault
See other posts from Server Fault
or by orzzzzz
Published on 2010-09-28T00:28:05Z
Indexed on
2010/12/31
21:55 UTC
Read the original article
Hit count: 137
nginx
moved from:http://stackoverflow.com/questions/3748517/does-nginx-upstream-has-a-port-setting
I use upstream
and proxy
for load balancing.
The directive proxy_pass http://upstream_name
uses the default port, which is 80.
However, if the upstream server does not listen on this port, then the request fails.
How do I specify an alternate port?
my configuration:
http{
#...
upstream myups{
server 192.168.1.100:6666;
server 192.168.1.101:9999;
}
#....
server{
listen 81;
#.....
location ~ /myapp {
proxy_pass http://myups:81/;
}
}
nginx -t:
[warn]: upstream "myups" may not have port 81 in /opt/nginx/conf/nginx.conf:78.
© Server Fault or respective owner