Добрый день.
Пытаюсь запустить на Кинетике микро-сайт. Не получается настроить выполнение php-скриптa. Может кто сталкивался.
Что делал:
Установил nginx, php8.
root@Keenetic:/opt/var/log$ opkg list-installed | grep php8
php8 - 8.0.13-1
php8-cgi - 8.0.13-1
php8-cli - 8.0.13-1
php8-fastcgi - 8.0.13-1
php8-fpm - 8.0.13-1
php8-mod-curl - 8.0.13-1
php8-mod-dom - 8.0.13-1
php8-mod-iconv - 8.0.13-1
php8-mod-mbstring - 8.0.13-1
php8-mod-session - 8.0.13-1
php8-mod-simplexml - 8.0.13-1
php8-mod-xml - 8.0.13-1
php8-mod-zip - 8.0.13-1
Поправил конфигурационный файл nginx:
...
server {
listen 8080;
server_name localhost;
#charset koi8-r;
#access_log /opt/var/log/nginx/host.access.log;
location / {
root /opt/share/nginx/html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root html;
# fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/opt/var/run/php8-fpm.sock;
fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME /opt/share/nginx/html$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
...
Настроил права и запустил php8-fpm
root@Keenetic:/opt/var/run$ ls -l
-rw-r--r-- 1 root root 4 Dec 10 08:00 dropbear.pid
-rw-r--r-- 1 root root 5 Dec 17 15:40 nginx.pid
-rw-r--r-- 1 root root 4 Dec 17 15:40 php8-fpm.pid
srw-rw---- 1 nobody nobody 0 Dec 17 15:40 php8-fpm.sock
В каталоге /opt/share/nginx/html создал файл info.php:
root@Keenetic:/opt/share/nginx/html$ cat info.php
<?php phpinfo(); ?>
При обращении браузером на http://192.168.2.1:8080 открывается тестовая страница nginx.
Если открыть http://192.168.2.1:8080/info.php - получаю сообщение "No input file specified."
При этом в логе nginx вижу записи:
2021/12/17 15:40:37 [error] 8656#0: *1 FastCGI sent in stderr: "Unable to open primary script: /opt/share/nginx/html/info.php (No such file or directory)" while reading response header from upstream, client: 192.168.2.xx, server: localhost, request: "GET /info.php HTTP/1.1", upstream: "fastcgi://unix:/opt/var/run/php8-fpm.sock:", host: "192.168.2.1:8080"
Проверил доступность файла /opt/share/nginx/html/info.php из под пользователя nobody - доступно, файл открывается на чтение.
Помогите дельным советом.