Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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 have the following vhost entry

    server {
    listen       80;

    #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 / {

    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

You need this:

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

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

Your Answer


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.