Does the nginx “upstream” directive have a port setting?
- by user55467
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.