I recently made a custom 404 page for my WordPress blog running on Nginx. However, the page lives above my root directory. I thought I set the parameters correctly, but it doesn't seem to be working (I still get the 404 page from my theme). Am I missing something simple? I'd appreciate any help.
...
...
...
root /var/www/wordpress/sitenamehere; #Set document root
autoindex off; #Turn off index browsing everywhere
index index.php index.html; #Set indexes to include .php before .html
#Error pages
error_page 404 /404.php;
location /404.php {
root /var/www/custom_404/404.php;
internal;
}
location / {
try_files $uri $uri/ /index.php?$args;
...
...
...
location ~* \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_index index.php;
include fastcgi_params;
}
...
...
...
Thanks!