October 20, 2013 03:11PM
server_name .site.com;

root /var/www/site.com;
error_page 404 /404.php;
access_log /var/log/nginx/site.access.log;
index index.html index.php;



if ($http_host != "www.site.com") {
rewrite ^ http://www.site.com$request_uri permanent;
}

location ~* \.php$ {
# try_files $uri = 404;
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:xxxx;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 4k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
fastcgi_read_timeout 240;

include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}

after adding error_page 404 /404.php

it works for other files which are not php. It calls the error page.
But if it is a php file, it shows "File not found."
Subject Author Posted

Which 404 file does nginx calls?

agriz October 20, 2013 12:02PM

Re: Which 404 file does nginx calls?

agriz October 20, 2013 03:11PM

Re: Which 404 file does nginx calls?

Francis Daly October 20, 2013 04:34PM

Re: Which 404 file does nginx calls?

agriz October 20, 2013 05:11PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 154
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