tags:

views:

1836

answers:

4

It seems that nginx is used with php, ruby and python.

Anyone has an example of how to setup nginx to work with jetty/tomcat in backend?

Thanks.

+3  A: 

nginx can forward via HTTP protocol, so just point it to the correct port and you're set:

server {
    location /anything {
        proxy_pass http://localhost:8080/whatever;
    }
}
Javier
Thank you. It seems that I was typing my own answer as you posted yours. It's my first go at nginx. Thank you.
Florin
+4  A: 

Right. I guess I qualify as a self learner, don't I.

Just add these lines within the http { } scope of the nginx.conf file:

server {
        listen          80;
        server_name     mydomain.com www.mydomain.com;
        access_log      /var/log/nginx_67_log main;
        location / {
                proxy_pass      http://127.0.0.1:8080;
                proxy_redirect  off;
                proxy_set_header        Host            $host;
                proxy_set_header        X-Real-IP       $remote_addr;
                proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        }
}

I have to try now gzip, SSL and dojo cometd and see if I can upgrade to nginx. Any clues are welcome.

Florin
A: 

was it able to work with gzip, ssl, cometd/dwr?

Yes. It worked with them all except cometd. I ended up using a combination of ajax/dwr over cometd and not because of nginx but because I cometd - I did not find it ready for primetime.
Florin
+1  A: 

I tested. CometD works with the above configuration.

Vinod