If your VPS is running CentOS and you use Control Web Panel (CWP), you may get this error at one time or the other: 502 Bad Gateway cwpsrv
For me, I got the error when I deleted a User through the CWP admin interface. When this error shows up, you cannot log into your CWP admin panel to carry out any tasks.
502 Bad Gateway Cwpsrv [SOLVED]
There are two ways you can solve the 502 Bad Gateway Cwpsrv error. In most cases, any 502 Bad Gateway error can be solved by running this command:
sh /scripts/restart_cwpsrv
If running the above command does not solve your problem, here’s the second option:
First off, you should check the phpfpm service to confirm that it is running. Type this command through SSH:
systemctl status cwp-phpfpm
If the service is not running and cannot start, you have to find the User that is producing the error. To do so, check this file /usr/local/cwp/php71/var/log/php-fpm.log
tail /usr/local/cwp/php71/var/log/php-fpm.log
You will see the name of User has an error (eg. stetho.conf).
Delete the file stetho.conf from /usr/local/cwp/php71/etc/php-fpm.d/users/stetho.conf by running this command:
rm -f /usr/local/cwp/php71/etc/php-fpm.d/users/stetho.conf
After this, run the following command to start Phpfpm
systemctl start cwp-phpfpm
From here, the 502 Bad Gateway cwpsrv should have been solved.
Let me know in the comment section below whether you have any questions.
Perfect.
Thank you, it works!
Hello Sir,
I’m trying to login via ssh, but to no avail, even when i try to connect via telnet the connection is lost immediately…
I’m the owner of the server, using Control Web Panel, via CentOS 7.6 server…
The Control Web Panel admins are being extremely difficult, like talking to a brick wall to be honest.
There was a required update to be performed, which I carried out as I normally would in the past with no issues, but this time the PHP-Switch update has appeared to bog down the server, now I can’t login, i keep getting 502 bad gateways…
do you have any other tips i can follow?
Thanks
Hi Loz,
If you cannot log into SSH, you should check your VPS credentials (password and username). SSH login is not related to CWP interface, but your VPS. Log into your VPS provider’s portal and check or change the password from there, then try loggin in.
Thank you very much! Who knows how many hours you’ve saved me!
perfect. it is working
Thanks so much bro
Worked Perfectly for me, Thank you.
Thank you! Saved my day 🙂
sh /scripts/restart_cwpsrv
worked like a charm.
Many thanks
just perfect..
Stopping cwpsrv: [ OK ]
Stopping cwpsrv-phpfpm: [ OK ]
Starting cwpsrv-phpfpm: [ OK ]
Stopping cwp-phpfpm: [FAILED]
Starting cwp-phpfpm: [ OK ]
Seems that for some reasons cwp-phpfpm was not running.
Many thanks…
Hello. In some cases, CWP7 installation script doesn’t create the groups cwpsrv and cwpsvc. So, u need to create these and restart cwp-phpfpm in order to stablish communication with the Webpanel.