Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

I would like to use nginx as a proxy to a Tomcat non-root app but am having problems to do that. This is the code that I use:

location / {
        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;
        proxy_max_temp_file_size 0;

        client_max_body_size       10m;
        client_body_buffer_size    128k;

        proxy_connect_timeout      90;
        proxy_send_timeout         90;
        proxy_read_timeout         90;

        proxy_buffer_size          4k;
        proxy_buffers              4 32k;
        proxy_busy_buffers_size    64k;
        proxy_temp_file_write_size 64k;

Now, this works ok for the app login screen but doesn't work for anything beyond that. After I login, the login page comes back so I think something is wrong with this kind of proxying, some kind of rewrite is obviously missing.

If I change it to something like:

location / {


location /app_v1.1.0 {

Then it works but i have to access my app via 'http:///app_v1.1.0' ... Can this be circumvented somehow?

Thank you.

share|improve this question
Perhaps this will answer your question?… – Mr Nil Feb 4 '14 at 19:08
I've tried it already, but that rewrite doesn't seem to help :-/ Maybe the application is broken in some way. I made a temporary fix by renaming app.war to ROOT.war and proxying '/' although I would like to do it the other way. – Jakov Sosic Feb 5 '14 at 22:19

Your Answer


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

Browse other questions tagged or ask your own question.