Question

502 Bad Gateway nginx/1.10.3 (Ubuntu) after migrating Wordpress from another hosting

Hello,

I am trying to run my Wordpress based website after migration from another hosting. Last time I did it it worked well but after my last successful migration I updated to Ubuntu 16.04.3.

Now I have 502 Bad Gateway nginx/1.10.3 (Ubuntu).

I tried to check log file /var/log/nginx/error.log — this file is empty 😕 I tried some advises from another threads (restarting nginx and php5-fpm) — it doesn’t help.

Please give me any advise how to find out the reason.

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

The /var/log/nginx/error.log last lines with me is:

2017/11/03 15:32:31 [error] 11344#11344: *8081 connect() to unix:/var/run/php/php7.0-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 82.145.223.13, server: ubuntufacile.tk, request: $

I can deduct that it is realy a php-fpm communication failed.

So, I try to change the FastCgi request path wich was “/run/php/php7.0-fpm.sock” in the file /etc/php/7.0/fpm/pool.d/www-conf by "127.0.0.1:9000" and do the same with the fastcgi parameter in my vhosts conf files. Then, i reload php-fpm and nginx service and my sites are back again.

in the /etc/php/7.0/fpm/pool.d/www-conf: Comment this line with (;) prefixe

;listen = /run/php/php7.0-fpm.sock 

then add bellow

listen = 127.0.0.1:9000;

Then, in the site conf file, (/etc/nginx/sites-available/) Comment this line with (#) prefixe

#fastcgi_pass /var/run/php/php7.0-fpm.sock;

then add bellow the line

fastcgi_pass 127.0.0.1:9000;

I hope just it is fix for ever despite of an futur packages upgrade, because, i’d try the same method before without success, reason for my previous apt purge and reinstall. Although, i used a single different socket php-fpm pool for each site/vhost before have the trouble lastly. It worked kindly during several months.

Sorry for my english… I’m french speaker

Hello, I have the same problem since 2 weeks on my droplet with all php installation am trying to run. I purged all nginx, php* then reinstall it again an set again all my vhost conf and it was working since yesterday… all my wordpress sites. But, am just coming to get the same problem now. My phpmyadmin new installation (after the previous apt purge) is a manualy installation with phpmyadmin archive: it brings me 502 too exactly like a phpinfo(); file . But any problem with Html site, on the sames vhost or not.

This comment has been deleted