Centos control panel (CWP)

502 bad gateway nginx

Image result for 502 bad gateway nginx cwp

In short, CWP 502 Bad Gateway error occurs when the PHP script handler PHP-FPM service is down. In today’s writeup, we discussed how our Support Engineers fixed this error effectively for our customers.

We checked whether the status of the service using the below command.

systemctl status cwp-phpfpm

Here, the service was not running and we were not able to start it. Then, we tried to find the User that caused the error by checking the log files.

tail /usr/local/cwp/php71/var/log/php-fpm.log

Here, we got the name of the user that caused the error. For instance, in our case bob.conf created problems.

After that, we deleted the file from /usr/local/cwp/php71/etc/php-fpm.d/users/bob.conf  by running the command,

Restarting the CWP webserver

Similarly, in many cases, restarting the CWP server will also remove the error.

To do so, we run the below command in the command prompt.

sh /scripts/restart_cwpsrv

This restarts the cwpsrv service and makes the panel working again

Configuration files

CWP Configuration files and locations

cwpsrv (webserver)
This is a web server for: cwp admin panel, cwp user panel, phpMyAdmin, roundcube
Configuration files/folders: /usr/local/cwpsrv/conf/ and /usr/local/cwpsrv/conf.d/
Reload command: service cwpsrv reload

cwp-phpfpm (php for cwpsrv)
This is php of cwpsrv for: cwp admin panel, cwp user panel, phpMyAdmin, roundcube
Configuration files/folders: /usr/local/cwp/php71/php.ini /usr/local/cwp/php71/php.d/
Reload command: service cwp-phpfpm reload

phpMyAdmin (MySQL Database manager)
php server configuration: /usr/local/cwp/php71/php.ini
script location: /usr/local/cwpsrv/var/services/pma/

RoundCube (WebMail)
php server configuration: /usr/local/cwp/php71/php.ini
script location: /usr/local/cwpsrv/var/services/roundcube/

Pure-FTP (Main FTP server)
configuration files: /etc/pure-ftpd/
Restart command: service pure-ftpd restart

Apache (main webserver)
configuration files: /usr/local/apache/conf/ and /usr/local/apache/conf.d/
Reload command: service httpd reload

Nginx (proxy webserver)
configuration files: /etc/nginx/
Reload command: service nginx reload

Varnish (cache webserver)
configuration files: /etc/varnish/
Reload command: service varnish reload

Dovecot (POP3/IMAP)
configuration files: /etc/dovecot/
Reload command: service dovecot reload

Postfix (SMTP)
configuration files: /etc/postfix/
Reload command: service postfix reload

MySQL/MariaDB
configuration files: /etc/my.cnf and in the folder /etc/my.cnf.d/
** Note that MariaDB has most of the config in file /etc/my.cnf.d/server.cnf

Restart command: service mysql restart

Bind (Named/DNS server)
configuration files: /etc/named.conf, /etc/named/, /var/named/
Reload command: service named reload

How to update CWP ?

If you want to force update you can do that by executing the following command.

sh /usr/local/cwpsrv/htdocs/resources/scripts/update_cwp

or

sh /scripts/update_cwp

Letsencrypt Free SSL on CWP

WebServer Settings->SSL Certificates

Leave a Comment

Your email address will not be published. Required fields are marked *

Open chat