displaying standard 404 page, if php file is not found

Samuel Vogel samydelux at gmail.com
Wed Jul 29 18:03:50 MSD 2009


Hey,

I know this question has come up a couple of times, but the solutions 
posted here do not seem to work for me!
Here is the important part of my configuration:

     location ~ \.php$ {
         try_files  $uri  @404;

         fastcgi_pass   unix:/var/run/php-fpm/tourvital.sock;
         fastcgi_index  index.php;
         fastcgi_param  SCRIPT_FILENAME  www/$fastcgi_script_name;
         include fastcgi_params;
     }

     location @404 {
         return 404;
     }

This returns a 404 error for every PHP file, even existing ones!

Regards,
Samy





More information about the nginx mailing list