tags:

views:

88

answers:

2

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.
+1  A: 
proxy_pass http://upstream_name:1234/
tylerl
I tried that before,but sbin/nginx -t failed.
orzzzzz
A: 

Thanks.Tried but no lucky... Test failed.

[warn]: upstream "myups" may not have port 81 in /opt/nginx/conf/nginx.conf:78.

BTW:close link not found.

my nginx: nginx version: nginx/0.8.50 built by gcc 4.1.2 20071124 (Red Hat 4.1.2-42)

orzzzzz
Please show your `upstream` code
ring0
show above in the question.Thanks.
orzzzzz