Forum: Rails deployment setting up nginx as reverse proxy for a mongrel_cluster

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
A4911c2072d2c07e17d79c47559b4767?d=identicon&s=25 Balint Erdi (balint)
on 2009-04-01 18:27
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
1a8ba6cf5e232c16ecefa1618e9fb4ed?d=identicon&s=25 Qas WM (qaswm)
on 2009-07-11 08:26
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
A4911c2072d2c07e17d79c47559b4767?d=identicon&s=25 Balint Erdi (balint)
on 2009-07-11 11:59
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
This topic is locked and can not be replied to.