Welcome! Log In Create A New Profile

Advanced

Re: displaying standard 404 page, if php file is not found

Samuel Vogel
July 29, 2009 11:26AM
Am 29.07.09 17:00, schrieb Igor Sysoev:
> On Wed, Jul 29, 2009 at 04:53:43PM +0200, Samuel Vogel wrote:
>
>
>> Am 29.07.09 16:12, schrieb Edho P Arief:
>>
>>> On Wed, Jul 29, 2009 at 9:03 PM, Samuel Vogel<samydelux@gmail.com> wrote:
>>>
>>>
>>>> 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/domain.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!
>>>>
>>>>
>>>>
>>> where did you set the root directive? in another location block or in
>>> server block?
>>>
>>> also I don't remember ever seeing relative path for script_filename
>>>
>> It's not relative, php ist just chrootet to /var/www/domain/.
>>
>> Here is my complete configuration:
>> server {
>> listen 80;
>> server_name domain.de;
>>
>> access_log /var/log/nginx/domain.access.log;
>>
>> location / {
>> root /var/www/domain/www;
>> index index.html index.php;
>> }
>>
>> location ~ \.php$ {
>> try_files $uri @404;
>>
> + root /www;
>
>
>> fastcgi_pass unix:/var/run/php-fpm/domain.sock;
>> fastcgi_index index.php;
>> fastcgi_param SCRIPT_FILENAME /www/$fastcgi_script_name;
>> include fastcgi_params;
>> }
>>
>> location @404 {
>> return 404;
>> }
>>
>> location ~ /\.ht {
>> deny all;
>> }
>> }
>>
Doesn't seem to fix the problem either. My config now reads:

server {
listen 80;
server_name domain.de;

access_log /var/log/nginx/domain.access.log;

location / {
root /var/www/domain/www;
index index.html index.php;
}

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

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

location @404 {
return 404;
}

location ~ /\.ht {
deny all;
}
}
Subject Author Posted

displaying standard 404 page, if php file is not found

Samuel Vogel July 29, 2009 10:03AM

Re: displaying standard 404 page, if php file is not found

edogawaconan July 29, 2009 10:12AM

Re: displaying standard 404 page, if php file is not found

Samuel Vogel July 29, 2009 10:53AM

Re: displaying standard 404 page, if php file is not found

Igor Sysoev July 29, 2009 11:00AM

Re: displaying standard 404 page, if php file is not found

Samuel Vogel July 29, 2009 11:26AM

Re: displaying standard 404 page, if php file is not found

edogawaconan July 29, 2009 11:39AM

Re: displaying standard 404 page, if php file is not found

Samuel Vogel July 29, 2009 12:12PM

Re: displaying standard 404 page, if php file is not found

edogawaconan July 29, 2009 01:14PM

Re: displaying standard 404 page, if php file is not found

Samuel Vogel July 29, 2009 01:25PM

Re: displaying standard 404 page, if php file is not found

Nuno Magalhães July 29, 2009 01:43PM

Re: displaying standard 404 page, if php file is not found

Piotr Sikora July 29, 2009 12:17PM

Re: displaying standard 404 page, if php file is not found

Samuel Vogel July 29, 2009 12:25PM

Re: displaying standard 404 page, if php file is not found

Igor Sysoev July 29, 2009 01:17PM

Re: displaying standard 404 page, if php file is not found

Samuel Vogel July 29, 2009 02:00PM

Re: displaying standard 404 page, if php file is not found

Nuno Magalhães July 29, 2009 10:57AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 189
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready