Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

moved from:

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:

upstream myups{
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.
share|improve this question

I think you are misinterpreting the meaning of the line:

proxy_pass http://myups;

This line is telling nginx to pass the request to one of the servers listed in the 'upstream myups' block. It is not going back out on to the internet to send a request to URL for the proxy_pass.

In other words, when a request come in to the nginx server on port 81 for the hostname you specified, it will pass the request on to either, or

Hope this clears it up a bit.

share|improve this answer

You should set the port only in "server" statements inside "upstream" definition.

(Which port does it listen on? 6666, 9999 or 81?)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.