Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have the following vhost entry

    server {
    listen       80;
    server_name  example.com www.example.com;

    #access_log   /var/log/nginx/nginx-access.log;

    location  /media/ {
    root /home/luke/django/solentcms;
     }

    location  /admin/media/ {
    root /home/luke/virts/django1.25/lib/python2.7/site-packages/django/contrib/admin/media;
     }

    location / {
    proxy_pass   http://127.0.0.1:8001;
    }

    error_page 404 /404.html;
    location = /404.html {
            root    /home/luke/django/solentcms/404;
            allow   all;
     }


    error_page 500 502 503 504 /500.html;
    location = /500.html {
            root    /home/luke/django/solentcms/404;
            allow   all;
     }

}

However, 404's and 50x errors are still be re-directed to the horrible nginx default pages.Any ideas as to why? This syntax works on one of my other servers.

share|improve this question

2 Answers 2

I suspect it's due to the error_page lines coming after location / in the configuration file. That block is proxying all requests back to whatever is on port 8001.

Try putting them earlier in the server block and see if that works.

share|improve this answer

You need this: http://wiki.nginx.org/HttpProxyModule#proxy_intercept_errors

share|improve this answer
    
Vadim is right. I don't have enough reputation to vote it up, though. –  Theuni Jan 31 '12 at 13:37

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.