Stuck with Vestacp 502 bad gateway? We can help you.
Vestacp 502 bad gateway issue occurs mainly due to lack of disk space or vesta session problems.
VestaCP is an open-source web control panel that is considered to be a great alternative to cPanel.
At Bobcares, we often receive requests from our customers to solve Vestacp errors as part of our Server Management Services.
Today, let’s see how our Support Engineers fix this gateway error for our customers.
Methods to fix Vestacp 502 bad gateway
Some of the common causes for Vestacp 502 bad gateway includes disk space issue, vesta session problem or even PHP-fpm service issues. Let’s see how our Support Techs fix this for our customers.
1. Lack of Disk Space
One of the most common reasons for this error is the disk space issue.
When disk space reaches the limit the Vestacp returns 502 gateway error.
To fix this we will check the disk space usage and availability using the below command:
If we notice the storage to be full, we can delete some unnecessary files and folders to increase the available space.
This is one way to fix this gateway error.
2. Vesta Session problem
We will delete the current vesta session folder to fix this.
The steps to follow are:
1. SSH to the server.
2. Then delete /usr/local/vesta/data/sessions folder using the following command:
rm -R /usr/local/vesta/data/sessions
3. Next we will create a new session folder using the following command:
4. After that, we will set the permission to 775 for the folder using the following command:
chmod -R 775 /usr/local/vesta/data/sessions
5. And we will change the owner of the folder to admin: admin with the following command:
chown -R admin: admin /usr/ local/vesta/data/sessions
6. After that, we check the file /usr/local/vesta/php/etc/php-fpm.confand make sure the file path.
php_admin_value [session.save_path] = /usr/local/vesta/data/sessions
7. Now we will edit the file /usr/local/vesta/php/etc/php-fpm.conf by adding the following lnes:
php_admin_value [memory_limit] = 256M php_admin_value [post_max_size] = 512M php_admin_value [upload_max_filesize] = 512M php_admin_value [max_execution_time] = 600 php_admin_value [max_input_time] = 600 php_admin_value [session.save_path] = /usr/local/vesta/data/sessions
8. Finally, we will restart the vesta service.
vesta service restart
3. Restarting the PHP-fpm service.
At times, the PHP-fpm service causes this 502 gateway time out error. So we will try restarting the service using the following command:
service php-fpm restart
[Still, stuck with this error?- We’ll help you.]
To conclude, we saw some of the common causes for Vestacp 502 bad gateway and the steps our Support Engineers follow to fix this.