Setting up nginx as reverse proxy for a mongrel_cluster

Hi,

I have a nginx set up to reverse proxy to a mongrel_cluster. The
relevant part of the nginx config is below:

upstream mongrel {
server 127.0.0.1:8000;
server 127.0.0.1:8001;
server 127.0.0.1:8002;
}
server {
(…)
if (!-f $request_filename) {
proxy_pass http://mongrel;
break;
}
}

And the config of the mongrel cluster:


user: mongrel
cwd: /opt/sites/xxx
log_file: log/mongrel.log
port: “8000”
environment: production
group: mongrel

address: 127.0.0.0

pid_file: tmp/pids/mongrel.pid
servers: 3

I start the mongrel_cluster with “sudo -u mongrel mongrel_rails
cluster::start”

The above setup works. However, what I would like to achieve is the to
have the mongrel_cluster only available through the rev. proxy (so
http://example.com:8000 will not work, only http://example.com). For
that I’d have to uncomment the above address: 127.0.0.0 line.

When I do that, I get an 502 accessing http://example.com and I am not
sure why. Also, all the nginx error logs are empty so I can not peek
into the problem. (I got the 502 from the access log). The entire config
files are here: http://gist.github.com/88662

Any help is appreciated,
Balint

I am not sure if I understand your question 100% but if what i
understood correct then you need to restart the nginx service. once this
is done, you should be able to see the correct site example.com without
the :8000

Quee Mm wrote:

I am not sure if I understand your question 100% but if what i
understood correct then you need to restart the nginx service. once this
is done, you should be able to see the correct site example.com without
the :8000

Maybe I was not clear. I would like the site not to be available
through the port numberered URL. So I would like http://example.com:8000
to be rejected and http://example.com to work.

It is not a big thing after all but it is kind of elegant to have the
:8000 version closed down.

Thank you for your help,
Bálint