Корневой веб-сайт — /www/html, и в пути у меня есть файл test.php. Структура папок:
Код: Выделить всё
775 myuser nginx job/
755 myuser nginx test.php
Тест test.php прост:
р>
Код: Выделить всё
Предупреждение: touch(): невозможно создать файл /www/html/job/test.txt, поскольку разрешение запрещено в /www/html/test.php в строке 3.
Предположим, у меня достаточно разрешений для записи файла.
Конфигурация PHP-FPM находится здесь:
Код: Выделить всё
upstream php-fpm {
server unix:/run/php-fpm/www.sock;
}
Код: Выделить всё
server {
listen 443 ssl;
server_name example.com;
ssl_certificate /path/to/ssl/fullchain.crt;
ssl_certificate_key /path/to/ssl/server.key;
location / {
proxy_pass http://localhost:3001;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location ^~ /script {
alias /www/html;
index index.php;
if (!-e $request_filename) { rewrite ^ /script/index.php last; }
location ~ \.php$ {
if (!-f $request_filename) { return 404; }
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
}
}
server {
listen 80;
server_name example.com;
# Redirect HTTP to HTTPS
return 301 https://$host$request_uri;
}
Как устранить проблему с разрешениями?< /п>
Подробнее здесь: https://stackoverflow.com/questions/793 ... -fpm-nginx