During the task like database migration, php5-fpm service can be stopped,so that nobody can access the Wordpress site during database maintenance is underway.
Stop the php5-fpm service
sudo service php5-fpm stop
After this accessing the website will show 502 Bad Gateway. We will replace this error with "Under Manintainance Page"
Configuring and creating custom 502(Bad Gateway)
sudo nano /etc/nginx/sites-enabled/default
Add the following config code in port 443 section of Nginx config file which is stated above.
error_page 502 /custom502.html;
location = /custom502.html {
root /var/www/html;
internal;
}
After that create /var/www/html/custom502.html
<html>
<body>
Site is currently under maintenance. Thank you for your understanding.
</body>
</html>
Restart the nginx server
sudo service restart nginx
After this access the website to see the "Under Maintenance Page" instead of Bad Gateway
Top comments (0)