我无法访问任何php文件。我很想将fastcgi_pass更改为127.0.0.1:9000,但这也不起作用。我看过其他有类似问题的人,但无济于事。这是我收到的错误消息:http://159.65.94.68/phpinfo.php
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.php 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 /usr/share/nginx/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$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$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;
#}
}
我的Nginx错误日志是
2019/02/15 13:06:28 [error] 14208#14208: *3 open() "/usr/share/nginx/html/favicon.ico" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "159.65.94.68"
2019/02/15 13:06:33 [crit] 14208#14208: *4 connect() to unix:/var/run/php/php7.3-fpm.sock failed (13: Permission denied) while connecting to upstream, client: 3.94.249.110, server: localhost, request: "GET /phpinfo.php HTTP/1.1", $upstream: "fastcgi://unix:/var/run/php/php7.3-fpm.sock:", host: "159.65.94.68"
如何解决此权限问题?
答案 0 :(得分:0)
我解决了它,并为其创建了一个教程,以备将来参考,因为所有旧版本仅适用于nginx 1.13及更低版本,但不适用于1.15 +
https://hostup.org/blog/install-wordpress-on-latest-nginx-mainline-version/