Всем доброго времени суток.
Подскажите, поставил nginx+php-fpm. Хочу банального - получить страничку ip/index.php
.
$ ll /usr/share/nginx/html
итого 12
-rw-r--r-- 1 root root 537 апр 17 18:48 50x.html
-rw-r--r-- 1 root root 612 апр 17 18:48 index.html
-rw-r--r-- 1 root root 45 окт 11 17:18 index.php
$ cat index.php
<?php
phpinfo();
phpinfo(INFO_MODULES);
?>
Но, если секции location ~ \.php$
указать $document_root$fastcgi_script_name
, то не работает: File not found. Приходится вручную писать /usr/share/nginx/html$fastcgi_script_name
.
$ vi /etc/nginx/conf.d/default.conf
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
location / {
index index.php index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
root html;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
С чем может быть связано? И, как можно посмотреть значение переменной $document_root
?