Customized 502 Bad Gateway Page(Nginx)
Zaw Htut Win
Posted on June 4, 2021
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
💖 💪 🙅 🚩
Zaw Htut Win
Posted on June 4, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
githubcopilot AI Innovations at Microsoft Ignite 2024 What You Need to Know (Part 2)
November 29, 2024