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 Started CWP service on the server but CWP admin panel started giving “502 Bad Gateway cwpsrv” error.
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:
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
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.