Author Topic: All my site are now showing 502 Bad Gateway nginx/1.20.2  (Read 3496 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
All my site are now showing 502 Bad Gateway nginx/1.20.2
« on: July 05, 2022, 01:36:10 PM »
Since à few sans, all my sites hosted on my cwp are shoping 502 Bad Gateway nginx/1.20.2.

Tried all classic stuff
- checked and fixer wordpress défaut rights
- rebuild webserver nginx

Please anyone have any hint?

Offline
***
Re: All my site are now showing 502 Bad Gateway nginx/1.20.2
« Reply #1 on: July 06, 2022, 08:20:03 PM »
+1  me too

Offline
*
Re: All my site are now showing 502 Bad Gateway nginx/1.20.2
« Reply #2 on: January 30, 2023, 11:16:18 PM »
Did you manage to solve it?

Offline
****
Re: All my site are now showing 502 Bad Gateway nginx/1.20.2
« Reply #3 on: January 31, 2023, 02:50:26 AM »
Need to see some error logs to nail it down...

Offline
*
Re: All my site are now showing 502 Bad Gateway nginx/1.20.2
« Reply #4 on: April 10, 2023, 10:24:13 PM »
I do have had this problem and believe it is related to the .sock file missing for the user.

Code: [Select]
2023/04/11 06:59:29 [crit] 5018#5018: *113 connect() to unix:/opt/alt/php-fpm80/usr/var/sockets/whocalau.sock failed (13: Permission denied) while connecting to upstream, client: 103.154.154.179, server: whocalled.au, request: "GET /wp-admin/plugin-install.php?s=w3%2520total&tab=search&type=term HTTP/1.1", upstream: "fastcgi://unix:/opt/alt/php-fpm80/usr/var/sockets/whocalau.sock:", host: "whocalled.au", referrer: "https://whocalled.au/wp-admin/plugins.php"

I rectified it temporarily by modifying my website .conf file to change the socket file to nobody.sock but it just means I lose some functionality in the backend of the Wordpress site, like not being able to install plugins directly and getting some permissions errors.

This is NOT a permanent fix. I would love to have a better solution.

Offline
****
Re: All my site are now showing 502 Bad Gateway nginx/1.20.2
« Reply #5 on: April 11, 2023, 02:13:37 AM »
When compiling new php-fpm versions, you don't automatically get a user.conf file created (and therefore a user.sock file). You should copy over your existing user.conf from the previous PHP version, change the paths therein appropriately for that PHP version, and restart that version of php-fpm. Also, I see you are using php 8.0. Any specific reason you are not using 8.1 instead? If not, I would recommend compiling 8.1 and using that instead of 8.0.

Offline
*
Re: All my site are now showing 502 Bad Gateway nginx/1.20.2
« Reply #6 on: April 11, 2023, 02:17:28 AM »
When compiling new php-fpm versions, you don't automatically get a user.conf file created (and therefore a user.sock file). You should copy over your existing user.conf from the previous PHP version, change the paths therein appropriately for that PHP version, and restart that version of php-fpm.

But I don't have an existing sock file to copy from unless I missing something? Where should I be looking for an existing one?

restart that version of php-fpm.

How do you do this? I've tried multiple commands and Google's with 0 success.

Also, I see you are using php 8.0. Any specific reason you are not using 8.1 instead? If not, I would recommend compiling 8.1 and using that instead of 8.0.

Just what I have started off with and some of my WordPress plugins are not compatible with 8.1 yet.

Offline
****
Re: All my site are now showing 502 Bad Gateway nginx/1.20.2
« Reply #7 on: April 11, 2023, 10:41:44 PM »
Here's an example for moving from php-fpm 7.4 to 8.0:
Code: [Select]
cp /opt/alt/php-fpm74/usr/etc/php-fpm.d/users/user.conf /opt/alt/php-fpm81/usr/etc/php-fpm.d/users/user.confThen edit the file (either manually or with a perl or sed substitution) to update it from 7.4 to 8.0:
Code: [Select]
perl -pi -e 's/php-fpm74/php-fpm80/g' /opt/alt/php-fpm81/usr/etc/php-fpm.d/users/user.confThen restart php 8.0
Code: [Select]
systemctl restart php-fpm80.serviceand confirm it made your .sock file:
Code: [Select]
ls -l /opt/alt/php-fpm80/usr/var/sockets/yellowdeli.sockIf it's present, then restart nginx.