While setting up my nginx configuration I came upon this. Does anyone have any idea on why this happens exactly?
root /folder/my_root;
index index.php index.html index.htm;
error_page 404 /404.html;
location = /404.html{
root $document_root/error_pages; //FAILS HERE with the error in the title
internal;
}
This variable is set by root directive. You cannot use it in root directive itself, because it will lead to infinite loop.
See http://nginx.org/r/root
The path value can contain variables, except
$document_rootand$realpath_root.
Use your own variable instead.
set $my_root folder/my_root;
root /$my_root;
...
location = /404.html {
root /$my_root/error_pages;
}
And don't try to put leading slash into variable. root $var will look for $var in some default directory like /usr/local/nginx or /etc/nginx.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With