12

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.

Cheers.

1 Answer 1

25

Are the errors coming from your backend? You may need to add proxy_intercept_errors on; alongside your proxy_pass.

Sign up to request clarification or add additional context in comments.

2 Comments

If you're using fastcgi, the setting is fastcgi_intercept_errors on;
Thanks, that help solve my error pages not showing too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.