Nginx, почему Access to the script?

Всем привет!
Есть задача перенести сайт с сервера FreeBSD 9.2 на Ubuntu 14.04.
На старом сервере виртуальный хост выглядит так:

server {
	listen       80;
        server_name  bo.aa *.bo.aa;
        if ($host ~* www\.(.*)) {
        set $host_without_www $1;
        rewrite ^(.*)$ http://$host_without_www$1 permanent; # $1 contains '/foo', not 'www.mydomain.com/foo'
        }
        root /usr/local/www/html;
        index index.php;
        charset utf-8;
        server_tokens off;

	try_files $uri @php_index;

 location @php_index {
 root /usr/local/www/html;
 fastcgi_pass 127.0.0.1:9000;
 fastcgi_buffer_size 15m;
 fastcgi_buffers 4 15m;
 fastcgi_index index.php;
 fastcgi_param SCRIPT_FILENAME /usr/local/www/html/index.php;
 include fastcgi_params;
 fastcgi_param SCRIPT_NAME /index.php;
 }
}

На убунте изменились только путь и fastcgi_pass:

server {
	listen       80;
        server_name  bo.aa *.bo.aa;
        if ($host ~* www\.(.*)) {
        set $host_without_www $1;
        rewrite ^(.*)$ http://$host_without_www$1 permanent; # $1 contains '/foo', not 'www.mydomain.com/foo'
        }
        root /usr/share/nginx/www;
        index index.php;
        charset utf-8;
        server_tokens off;

	try_files $uri @php_index;

 location @php_index {
 root /usr/share/nginx/www;
 fastcgi_pass unix:/var/run/php5-fpm.sock;
 fastcgi_buffer_size 15m;
 fastcgi_buffers 4 15m;
 fastcgi_index index.php;
 fastcgi_param SCRIPT_FILENAME /usr/share/nginx/www/index.php;
 include fastcgi_params;
 fastcgi_param SCRIPT_NAME /index.php;
 }
}


Но в браузере выдает ошибку: Access denied.
И в логе:

2015/09/06 21:52:11 [error] 18881#0: *1 FastCGI sent in stderr: "Access to the script '/usr/share/nginx/www' has been denied (see security.limit_extensions)" while reading response header from upstream, client: 192.168.0.19, server: bo.aa, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "bo.aa"


Но, когда заменяю строки:
try_files $uri @php_index;

 location @php_index {

на

location ~ \.php$ {

то все нормально.
Кто то может объяснить почему вылазит эта ошибка?
  • Вопрос задан
  • 1317 просмотров
Пригласить эксперта
Ответы на вопрос 1
ruvasik
@ruvasik
https://www.bryce.ru
Видимо у FPM нет прав на указанную папку/скрипт.
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы