nginx 500 error instead of 404

Posted by arby on Server Fault See other posts from Server Fault or by arby
Published on 2012-06-19T02:01:33Z Indexed on 2012/06/19 3:17 UTC
Read the original article Hit count: 497

Filed under:

I have the following nginx configuration (at /etc/nginx/sites-available/default)

server {
    listen   80; ## listen for ipv4; this line is default and implied
    listen   [::]:80 default ipv6only=on; ## listen for ipv6

    root /usr/share/nginx/www;
    index index.php index.html index.htm;

    server_name _;

    location / {
            try_files $uri $uri/ /index.html;
    }

    error_page 404 /404.html;

    location ~ \.php$ {
            try_files $uri =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/tmp/php5-fpm.sock;
            fastcgi_index index.php;
            include fastcgi_params;
    }

    location ~ /\.ht {
            deny all;
    }
}

Instead of a 404 error, I'm getting 500 server errors on broken urls. How can I correct this?

© Server Fault or respective owner

Related posts about nginx