I am trying to configure CentOS 7.3
, Nginx
and PHP 7.3
, but I am getting:
502 Bad Gateway nginx/1.10.3
This is site.com.conf:
server {
listen 80;
server_name server IP;
root /var/www/site.com/public;
index index.php index.html index.htm;
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
include fastcgi_params;
}
}
If I upload static HTML to the public directory, I can see it, but if I try to load PHP files, i see that error. I have /var/run/php-fpm/php-fpm.sock
.
The solution was to change listen.owner
and listen.groups
in /etc/php-fpm.d/www.conf
to nginx
:
listen.owner = nginx
listen.group = nginx
Then restart with service php-fpm restart
. You can check for errors with: systemctl status php-fpm.service
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.