Пытаюсь на локалке развернуть свой сайт с хостинга. Нашел для Nginx конфиг для Wordpress:
server {
listen 80;
server_name domen.ru www.domen.ru;
root /var/www/domen.ru/public_html;
index index.php;
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
location ~* ^.+.(js|css|png|jpg|jpeg|gif|ico)$ {
access_log off;
expires max;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_param DOCUMENT_ROOT /domen.ru/public_html;
fastcgi_param SCRIPT_FILENAME /domen.ru/public_html$fastcgi_script_name;
fastcgi_param PATH_TRANSLATED /domen.ru/public_html$fastcgi_script_name;
include fastcgi_params;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_intercept_errors on;
fastcgi_ignore_client_abort off;
fastcgi_connect_timeout 60;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
## Disable viewing .htaccess & .htpassword
location ~ /\.ht {
deny all;
}
}
Файл создал, валидность проверил. Владельца и права сменил:
chown -R www-data /var/www/domen.ru && chmod -R 750 /var/www/domen.ru
И в error.log вижу это:
2016/07/30 00:41:06 [error] 22692#22692: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1, server: domen.ru, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "domen.ru"
И теперь вопрос: что не нравится php? Какой ему скрипт нужен?
В это же время такой конфиг для тестов работает:
server {
listen 80;
listen [::]:80;
root /var/www/php.local;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name php.local www.php.local;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php7.0-cgi alone:
#fastcgi_pass 127.0.0.1:9000;
# With php7.0-fpm:
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}