Php 502坏网关nginx/1.19.1
我已经安装了Php 502坏网关nginx/1.19.1,php,nginx,Php,Nginx,我已经安装了nginx版本:nginx/1.19.1,php7.4.8(fpm-fcgi)和php7.4.8(cli) 我的nginx服务器块配置: 我测试它的“给我”错误 Nginx日志错误: 给我权限被拒绝了,所以 为什么会发生这种情况?要花很多时间来解决 我通过将etc/nginx/nginx.conf{user nginx}更改为{user www data}来解决其实际权限问题,然后保存并重新启动nginx(sudo systemctl restart nginx)。 user w
nginx版本:nginx/1.19.1
,php7.4.8(fpm-fcgi)
和php7.4.8(cli)
我的nginx服务器块配置:
我测试它的“给我”错误
Nginx日志错误:
给我权限被拒绝了,所以
为什么会发生这种情况?要花很多时间来解决 我通过将etc/nginx/nginx.conf{user nginx}更改为{user www data}来解决其实际权限问题,然后保存并重新启动nginx(sudo systemctl restart nginx)。
user www-data;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/sites-enabled/*;
}
我还不能发表评论,所以我写这篇文章作为回答。 你所做的只是一种方式。 另一种方法是在
/etc/php/7.4/fpm/pool.d/www.conf
中更改用户:
user = nginx
group = nginx
listen.owner = nginx
listen.group = nginx
就个人而言,我更喜欢为php fpm更改用户,而不是为nginx更改用户
干杯。套接字
/var/run/php/php7.4-fpm.sock
是否存在?Nginx是否有访问权限?是,套接字存在
user www-data;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/sites-enabled/*;
}
user = nginx
group = nginx
listen.owner = nginx
listen.group = nginx