displaying standard 404 page, if php file is not found

Samuel Vogel samydelux at gmail.com
Wed Jul 29 22:00:22 MSD 2009


Am 29.07.09 19:17, schrieb Igor Sysoev:
> On Wed, Jul 29, 2009 at 06:25:28PM +0200, Samuel Vogel wrote:
>    
>> Am 29.07.09 18:17, schrieb Piotr Sikora:
>>      
>>>>         try_files  $uri  @404;
>>>>          
>>> Try using "error_page" instead of "try_files".
>>>
>>> AFAIK "try_files" is supposed to work static files, not FastCGI / proxy.
>>>        
>> But the file does exist, shouldn't try_files be able to check that?
>>      
> try_files is able to check. You just need to set valid root in
>
> location ~ \.php$ {
>
> it may be
>
>      root   /var/www/domain/www;
> or
>      root   /www;
>
> depending on your setup.
>    
Thanks, your post solved the problem! The problem was, that of course 
root was only set for location /, and not in the php location.
Moved it to the server {} definition and everything works fine!

Regards,
Samy





More information about the nginx mailing list