502 Bad Gateway when installing PHP7.2 on nginx 502 Bad Gateway when installing PHP7.2 on nginx nginx nginx

502 Bad Gateway when installing PHP7.2 on nginx


I had same problem, so I changed the nginx config file /etc/nginx/sites-avaiable/your-site.

Change:

fastcgi_pass unix:/run/php/php7.1-fpm.sock;

to

fastcgi_pass unix:/run/php/php7.2-fpm.sock;

This worked for me.


Go to /etc/nginx/sites-avaiable/YOURSITENAME

Change

fastcgi_pass unix:/run/php/php7.X-fpm.sock;

to

fastcgi_pass unix:/run/php/php7.2-fpm.sock;

Restart service

sudo service nginx restart


CentOS8 nginx Mariadb PHP7.2 on a free one year trial cloud server:

CentOS-8.1_64bitPlan: G2.1GBCPU: 1 vCPURAM: 1 GBDisk: 40 GB

After many struggles, tearouts and reinstalls, I can confirm that in:

/usr/share/nginx/html/*.php

You need:

echo <?php phpinfo(); ?>

But, you also need to change file ownership:

sudo chown nginx:nginx usr/share/nginx/html/ -R

Now I can drink to enjoy and not to forget about nights of tail chasing!