When i try accessing info.php
I get a File not found.
error.
I tried some Tutorials to no avail.
Configs: default:
ser
In location
nginx section, if you use root
then the value for $document_root$fastcgi_script_name
is correct. But if you use alias
the value is wrong. When use alias
you need use $request_filename
instead of $document_root$fastcgi_script_name
.
location /myapp {
alias /home/site/www/myapp;
location ~* "\.php$" {
fastcgi_pass php_fpm_server:9000;
fastcgi_index index.php;
# Works in all cases.
fastcgi_param SCRIPT_FILENAME $request_filename;
## Not work for 'alias' directive, only for 'root' directive.
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
$request_filename
file path for the current request, based on the root or alias directives, and the request URI
$document_root
root or alias directive’s value for the current request
$fastcgi_script_name
request URI or, if a URI ends with a slash, request URI with an index file name configured by the fastcgi_index directive appended to it. This variable can be used to set the SCRIPT_FILENAME and PATH_TRANSLATED parameters that determine the script name in PHP. For example, for the “/info/” request with the following directives
Note, if root /var/www;
is a symlink, change it to root /var/www/;
otherwise nginx won't go past the symlink and you'll get a File not found
error