{"id":54750,"date":"2026-07-21T06:51:21","date_gmt":"2026-07-21T06:51:21","guid":{"rendered":"https:\/\/accuweb.cloud\/resource\/?post_type=cs_article&#038;p=54750"},"modified":"2026-07-21T06:51:21","modified_gmt":"2026-07-21T06:51:21","slug":"how-to-fix-502-504-gateway-errors","status":"publish","type":"cs_article","link":"https:\/\/accuweb.cloud\/resource\/cs\/how-to-fix-502-504-gateway-errors","title":{"rendered":"How to Fix 502\/504 Gateway Errors"},"content":{"rendered":"<h1 class=\"ack-h1\">How to Fix 502\/504 Gateway Errors<\/h1>\n<p>A 502 Bad Gateway or 504 Gateway Timeout usually means the web server isn\u2019t getting a valid response from the backend application. The site may still be up, but the connection between the proxy and the app is failing.<\/p>\n<p>This can happen when the backend service is down, the server is overloaded, the proxy is pointing to the wrong port, or a firewall is blocking traffic. The fastest way to narrow it down is to check the service status, logs, and server load first.<\/p>\n<h2 class=\"ack-h2\">Common causes<\/h2>\n<p>Gateway errors are usually caused by one of these:<\/p>\n<ul>\n<li>The backend application is not running.<\/li>\n<li>The reverse proxy has the wrong IP address or port.<\/li>\n<li>The application is slow or overloaded.<\/li>\n<li>CPU or memory usage is too high.<\/li>\n<li>Firewall rules are blocking the connection.<\/li>\n<\/ul>\n<h3 class=\"ack-h3\">Step 1: Connect to the server<\/h3>\n<p>Log in to your virtual machine over SSH first.<\/p>\n<p>ssh root@&lt;your-server-ip&gt;<\/p>\n<p>Once you are connected, you can start checking the services and logs.<\/p>\n<h3 class=\"ack-h3\">Step 2: Check the web server<\/h3>\n<p>Start by confirming that the web server is running.<\/p>\n<p>For Nginx:<\/p>\n<p>sudo systemctl status nginx<\/p>\n<p>sudo systemctl start nginx<\/p>\n<p><a href=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-2-Check-the-web-server.png\"><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter size-full wp-image-54751\" src=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-2-Check-the-web-server.png\" alt=\"\" width=\"2048\" height=\"784\" srcset=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-2-Check-the-web-server.png 2048w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-2-Check-the-web-server-300x115.png 300w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-2-Check-the-web-server-1024x392.png 1024w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-2-Check-the-web-server-768x294.png 768w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-2-Check-the-web-server-1536x588.png 1536w\" sizes=\"(max-width: 2048px) 100vw, 2048px\" \/><\/a><\/p>\n<p>For Apache on Ubuntu or Debian:<\/p>\n<p>sudo systemctl status apache2<\/p>\n<p>For Apache on AlmaLinux or CentOS:<\/p>\n<p>sudo systemctl status https<\/p>\n<p><a href=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/AlmaLinux-or-CentOS.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-54752\" src=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/AlmaLinux-or-CentOS.png\" alt=\"\" width=\"2026\" height=\"732\" srcset=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/AlmaLinux-or-CentOS.png 2026w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/AlmaLinux-or-CentOS-300x108.png 300w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/AlmaLinux-or-CentOS-1024x370.png 1024w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/AlmaLinux-or-CentOS-768x277.png 768w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/AlmaLinux-or-CentOS-1536x555.png 1536w\" sizes=\"(max-width: 2026px) 100vw, 2026px\" \/><\/a><\/p>\n<p>If Apache is stopped, start the service and verify whether the website becomes accessible again.<\/p>\n<h3 class=\"ack-h3\">Step 3: Check the backend application<\/h3>\n<p>Even if Nginx or Apache is running, the site will still fail if the backend app is down.<\/p>\n<p>If the app is managed by PM2:<\/p>\n<p>pm2 status<\/p>\n<p><a href=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-3-Check-the-backend-application.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-54753\" src=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-3-Check-the-backend-application.png\" alt=\"\" width=\"2048\" height=\"244\" srcset=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-3-Check-the-backend-application.png 2048w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-3-Check-the-backend-application-300x36.png 300w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-3-Check-the-backend-application-1024x122.png 1024w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-3-Check-the-backend-application-768x92.png 768w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-3-Check-the-backend-application-1536x183.png 1536w\" sizes=\"(max-width: 2048px) 100vw, 2048px\" \/><\/a><\/p>\n<p>If it runs as a system service:<\/p>\n<p>systemctl status your-service<\/p>\n<p>For PHP apps, check PHP-FPM too, for example:<\/p>\n<p>sudo systemctl status php8.1-fpm<\/p>\n<p>sudo systemctl restart php8.1-fpm<\/p>\n<p><a href=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/systemctl-restart-.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-54754\" src=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/systemctl-restart-.png\" alt=\"\" width=\"2048\" height=\"979\" srcset=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/systemctl-restart-.png 2048w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/systemctl-restart--300x143.png 300w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/systemctl-restart--1024x490.png 1024w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/systemctl-restart--768x367.png 768w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/systemctl-restart--1536x734.png 1536w\" sizes=\"(max-width: 2048px) 100vw, 2048px\" \/><\/a><\/p>\n<p>A stopped PHP-FPM service is one of the most common reasons for 502 errors on PHP-based sites.<\/p>\n<h3 class=\"ack-h3\">Step 4: Review the logs<\/h3>\n<p>Logs usually tell you what is actually wrong.<\/p>\n<p>For Nginx:<\/p>\n<p>sudo tail -f \/var\/log\/nginx\/error.log<\/p>\n<p>Common messages include:<\/p>\n<ul>\n<li>connect() failed (111: Connection refused)<\/li>\n<li>upstream timed out<\/li>\n<\/ul>\n<p><a href=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-4-Review-the-logs.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-54755\" src=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-4-Review-the-logs.png\" alt=\"\" width=\"2016\" height=\"256\" srcset=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-4-Review-the-logs.png 2016w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-4-Review-the-logs-300x38.png 300w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-4-Review-the-logs-1024x130.png 1024w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-4-Review-the-logs-768x98.png 768w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-4-Review-the-logs-1536x195.png 1536w\" sizes=\"(max-width: 2016px) 100vw, 2016px\" \/><\/a><\/p>\n<p>For Apache, check the relevant error log:<\/p>\n<p>Ubuntu or Debian:<\/p>\n<p>sudo tail -f \/var\/log\/apache2\/error.log<\/p>\n<p>AlmaLinux or CentOS:<\/p>\n<p>sudo tail -f \/var\/log\/httpd\/error_log<\/p>\n<p><a href=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/AlmaLinux-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-54756\" src=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/AlmaLinux-1.png\" alt=\"\" width=\"2048\" height=\"198\" srcset=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/AlmaLinux-1.png 2048w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/AlmaLinux-1-300x29.png 300w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/AlmaLinux-1-1024x99.png 1024w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/AlmaLinux-1-768x74.png 768w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/AlmaLinux-1-1536x149.png 1536w\" sizes=\"(max-width: 2048px) 100vw, 2048px\" \/><\/a><\/p>\n<p>You should also check application logs:<\/p>\n<p>pm2 logs<\/p>\n<p><a href=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/pm2-logs.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-54757\" src=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/pm2-logs.png\" alt=\"\" width=\"2048\" height=\"685\" srcset=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/pm2-logs.png 2048w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/pm2-logs-300x100.png 300w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/pm2-logs-1024x343.png 1024w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/pm2-logs-768x257.png 768w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/pm2-logs-1536x514.png 1536w\" sizes=\"(max-width: 2048px) 100vw, 2048px\" \/><\/a><\/p>\n<p>journalctl -u your-service<\/p>\n<p><a href=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/journalctl-u-your-service.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-54758\" src=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/journalctl-u-your-service.png\" alt=\"\" width=\"2048\" height=\"323\" srcset=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/journalctl-u-your-service.png 2048w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/journalctl-u-your-service-300x47.png 300w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/journalctl-u-your-service-1024x162.png 1024w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/journalctl-u-your-service-768x121.png 768w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/journalctl-u-your-service-1536x242.png 1536w\" sizes=\"(max-width: 2048px) 100vw, 2048px\" \/><\/a><\/p>\n<p>These logs often show whether the app failed to start, crashed, or simply took too long to respond.<\/p>\n<h3 class=\"ack-h3\">Step 5: Check server resources<\/h3>\n<p>If the server is under heavy load, the backend may respond too slowly and trigger a gateway error.<\/p>\n<p>Check CPU usage:<\/p>\n<p>top<\/p>\n<p><a href=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-5-Check-server-resources.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-54759\" src=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-5-Check-server-resources.png\" alt=\"\" width=\"2048\" height=\"623\" srcset=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-5-Check-server-resources.png 2048w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-5-Check-server-resources-300x91.png 300w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-5-Check-server-resources-1024x312.png 1024w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-5-Check-server-resources-768x234.png 768w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-5-Check-server-resources-1536x467.png 1536w\" sizes=\"(max-width: 2048px) 100vw, 2048px\" \/><\/a><\/p>\n<p>Check memory:<\/p>\n<p>free -h<\/p>\n<p><a href=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Check-memory.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-54760\" src=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Check-memory.png\" alt=\"\" width=\"1808\" height=\"294\" srcset=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Check-memory.png 1808w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Check-memory-300x49.png 300w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Check-memory-1024x167.png 1024w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Check-memory-768x125.png 768w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Check-memory-1536x250.png 1536w\" sizes=\"(max-width: 1808px) 100vw, 1808px\" \/><\/a><\/p>\n<p>Check disk space:<\/p>\n<p>df -h<\/p>\n<p><a href=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Check-disk-space.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-54761\" src=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Check-disk-space.png\" alt=\"\" width=\"1274\" height=\"502\" srcset=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Check-disk-space.png 1274w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Check-disk-space-300x118.png 300w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Check-disk-space-1024x403.png 1024w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Check-disk-space-768x303.png 768w\" sizes=\"(max-width: 1274px) 100vw, 1274px\" \/><\/a><\/p>\n<p>If CPU, RAM, or disk space is consistently high, stop unnecessary services or upgrade the VM if needed.<\/p>\n<h3 class=\"ack-h3\">Step 6: Test the backend directly<\/h3>\n<p>Instead of testing through the browser, hit the backend from the server itself.<\/p>\n<p>curl <a href=\"http:\/\/127.0.0.1:3000\">http:\/\/127.0.0.1:3000<\/a><\/p>\n<p><a href=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-6-Test-the-backend-directly.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-54762\" src=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-6-Test-the-backend-directly.png\" alt=\"\" width=\"1320\" height=\"162\" srcset=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-6-Test-the-backend-directly.png 1320w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-6-Test-the-backend-directly-300x37.png 300w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-6-Test-the-backend-directly-1024x126.png 1024w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-6-Test-the-backend-directly-768x94.png 768w\" sizes=\"(max-width: 1320px) 100vw, 1320px\" \/><\/a><\/p>\n<p>If you get a response, the backend is reachable. If the command fails or hangs, the app may be down or listening on a different port.<\/p>\n<h3 class=\"ack-h3\">Step 7: Check firewall settings<\/h3>\n<p>If the web server and backend are both running, make sure traffic between them is not being blocked.<\/p>\n<p>You can also verify the firewall rules from the <b>Network<\/b> section of your VM in AccuWeb.Cloud portal. You can follow the firewall guide here:<a href=\"https:\/\/accuweb.cloud\/resource\/cs\/configure-firewall-rules-for-a-virtual-machine\" target=\"_blank\" rel=\"noopener\"> Configure firewall rules for a virtual machine<\/a>.<\/p>\n<p><a href=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-7-Check-firewall-settings.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-54763\" src=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-7-Check-firewall-settings.png\" alt=\"\" width=\"2048\" height=\"959\" srcset=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-7-Check-firewall-settings.png 2048w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-7-Check-firewall-settings-300x140.png 300w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-7-Check-firewall-settings-1024x480.png 1024w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-7-Check-firewall-settings-768x360.png 768w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-7-Check-firewall-settings-1536x719.png 1536w\" sizes=\"(max-width: 2048px) 100vw, 2048px\" \/><\/a><\/p>\n<h3 class=\"ack-h3\">Step 8: Restart the services<\/h3>\n<p>After making changes, restart the affected services.<\/p>\n<p>sudo systemctl restart nginx<\/p>\n<p>sudo systemctl restart php8.1-fpm<\/p>\n<p>sudo systemctl restart your-service<\/p>\n<p><a href=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-8-Restart-the-services.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-54764\" src=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-8-Restart-the-services.png\" alt=\"\" width=\"1148\" height=\"188\" srcset=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-8-Restart-the-services.png 1148w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-8-Restart-the-services-300x49.png 300w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-8-Restart-the-services-1024x168.png 1024w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-8-Restart-the-services-768x126.png 768w\" sizes=\"(max-width: 1148px) 100vw, 1148px\" \/><\/a><\/p>\n<p>Then refresh the website and check whether the error is gone.<\/p>\n<h2 class=\"ack-h2\">Tips to avoid future errors<\/h2>\n<p>A few simple habits can prevent these errors from coming back:<\/p>\n<ul>\n<li>Keep backend services running with PM2 or systemd.<\/li>\n<li>Monitor CPU, memory, and disk usage regularly.<\/li>\n<li>Check logs as soon as something behaves strangely.<\/li>\n<li>Keep your operating system and web server packages updated.<\/li>\n<li>Make sure proxy settings and ports stay in sync.stackify+3<\/li>\n<\/ul>\n<h2 class=\"ack-h2\">Final thoughts<\/h2>\n<p>A 502 Bad Gateway or 504 Gateway Timeout usually points to a communication problem between the web server and the backend application, not a full server failure. In most cases, checking the service status, logs, server resources, and firewall rules will lead you to the cause quickly.<\/p>\n","protected":false},"excerpt":{"rendered":"<div class='heateorSssClear'><\/div><div  class='heateor_sss_sharing_container heateor_sss_horizontal_sharing' data-heateor-sss-href='https:\/\/accuweb.cloud\/resource\/cs\/how-to-fix-502-504-gateway-errors'><div class='heateor_sss_sharing_title' style=\"font-weight:bold\" ><\/div><div class=\"heateor_sss_sharing_ul\"><a aria-label=\"Facebook\" class=\"heateor_sss_facebook\" href=\"https:\/\/www.facebook.com\/sharer\/sharer.php?u=https%3A%2F%2Faccuweb.cloud%2Fresource%2Fcs%2Fhow-to-fix-502-504-gateway-errors\" title=\"Facebook\" rel=\"nofollow noopener\" target=\"_blank\" style=\"font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle\"><span class=\"heateor_sss_svg\" style=\"background-color:#0765FE;width:30px;height:30px;border-radius:999px;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;box-sizing:content-box\"><svg style=\"display:block;border-radius:999px;\" focusable=\"false\" aria-hidden=\"true\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"100%\" height=\"100%\" viewBox=\"0 0 32 32\"><path fill=\"#000\" d=\"M28 16c0-6.627-5.373-12-12-12S4 9.373 4 16c0 5.628 3.875 10.35 9.101 11.647v-7.98h-2.474V16H13.1v-1.58c0-4.085 1.849-5.978 5.859-5.978.76 0 2.072.15 2.608.298v3.325c-.283-.03-.775-.045-1.386-.045-1.967 0-2.728.745-2.728 2.683V16h3.92l-.673 3.667h-3.247v8.245C23.395 27.195 28 22.135 28 16Z\"><\/path><\/svg><\/span><\/a><a aria-label=\"X\" class=\"heateor_sss_button_x\" href=\"https:\/\/twitter.com\/intent\/tweet?text=How%20to%20Fix%20502%2F504%20Gateway%20Errors&url=https%3A%2F%2Faccuweb.cloud%2Fresource%2Fcs%2Fhow-to-fix-502-504-gateway-errors\" title=\"X\" rel=\"nofollow noopener\" target=\"_blank\" style=\"font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle\"><span class=\"heateor_sss_svg heateor_sss_s__default heateor_sss_s_x\" style=\"background-color:#2a2a2a;width:30px;height:30px;border-radius:999px;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;box-sizing:content-box\"><svg width=\"100%\" height=\"100%\" style=\"display:block;border-radius:999px;\" focusable=\"false\" aria-hidden=\"true\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 32 32\"><path fill=\"#000\" d=\"M21.751 7h3.067l-6.7 7.658L26 25.078h-6.172l-4.833-6.32-5.531 6.32h-3.07l7.167-8.19L6 7h6.328l4.37 5.777L21.75 7Zm-1.076 16.242h1.7L11.404 8.74H9.58l11.094 14.503Z\"><\/path><\/svg><\/span><\/a><a aria-label=\"Linkedin\" class=\"heateor_sss_button_linkedin\" href=\"https:\/\/www.linkedin.com\/sharing\/share-offsite\/?url=https%3A%2F%2Faccuweb.cloud%2Fresource%2Fcs%2Fhow-to-fix-502-504-gateway-errors\" title=\"Linkedin\" rel=\"nofollow noopener\" target=\"_blank\" style=\"font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle\"><span class=\"heateor_sss_svg heateor_sss_s__default heateor_sss_s_linkedin\" style=\"background-color:#0077b5;width:30px;height:30px;border-radius:999px;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;box-sizing:content-box\"><svg style=\"display:block;border-radius:999px;\" focusable=\"false\" aria-hidden=\"true\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"100%\" height=\"100%\" viewBox=\"0 0 32 32\"><path d=\"M6.227 12.61h4.19v13.48h-4.19V12.61zm2.095-6.7a2.43 2.43 0 0 1 0 4.86c-1.344 0-2.428-1.09-2.428-2.43s1.084-2.43 2.428-2.43m4.72 6.7h4.02v1.84h.058c.56-1.058 1.927-2.176 3.965-2.176 4.238 0 5.02 2.792 5.02 6.42v7.395h-4.183v-6.56c0-1.564-.03-3.574-2.178-3.574-2.18 0-2.514 1.7-2.514 3.46v6.668h-4.187V12.61z\" fill=\"#000\"><\/path><\/svg><\/span><\/a><a aria-label=\"Whatsapp\" class=\"heateor_sss_whatsapp\" href=\"https:\/\/api.whatsapp.com\/send?text=How%20to%20Fix%20502%2F504%20Gateway%20Errors%20https%3A%2F%2Faccuweb.cloud%2Fresource%2Fcs%2Fhow-to-fix-502-504-gateway-errors\" title=\"Whatsapp\" rel=\"nofollow noopener\" target=\"_blank\" style=\"font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle\"><span class=\"heateor_sss_svg\" style=\"background-color:#55eb4c;width:30px;height:30px;border-radius:999px;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;box-sizing:content-box\"><svg style=\"display:block;border-radius:999px;\" focusable=\"false\" aria-hidden=\"true\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"100%\" height=\"100%\" viewBox=\"-6 -5 40 40\"><path class=\"heateor_sss_svg_stroke heateor_sss_no_fill\" stroke=\"#000\" stroke-width=\"2\" fill=\"none\" d=\"M 11.579798566743314 24.396926207859085 A 10 10 0 1 0 6.808479557110079 20.73576436351046\"><\/path><path d=\"M 7 19 l -1 6 l 6 -1\" class=\"heateor_sss_no_fill heateor_sss_svg_stroke\" stroke=\"#000\" stroke-width=\"2\" fill=\"none\"><\/path><path d=\"M 10 10 q -1 8 8 11 c 5 -1 0 -6 -1 -3 q -4 -3 -5 -5 c 4 -2 -1 -5 -1 -4\" fill=\"#000\"><\/path><\/svg><\/span><\/a><a aria-label=\"Instagram\" class=\"heateor_sss_button_instagram\" href=\"https:\/\/www.instagram.com\/\" title=\"Instagram\" rel=\"nofollow noopener\" target=\"_blank\" style=\"font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle\"><span class=\"heateor_sss_svg\" style=\"background-color:#53beee;width:30px;height:30px;border-radius:999px;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;box-sizing:content-box\"><svg style=\"display:block;border-radius:999px;\" version=\"1.1\" viewBox=\"-10 -10 148 148\" width=\"100%\" height=\"100%\" xml:space=\"preserve\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" xmlns:xlink=\"http:\/\/www.w3.org\/1999\/xlink\"><g><g><path d=\"M86,112H42c-14.336,0-26-11.663-26-26V42c0-14.337,11.664-26,26-26h44c14.337,0,26,11.663,26,26v44 C112,100.337,100.337,112,86,112z M42,24c-9.925,0-18,8.074-18,18v44c0,9.925,8.075,18,18,18h44c9.926,0,18-8.075,18-18V42 c0-9.926-8.074-18-18-18H42z\" fill=\"#000\"><\/path><\/g><g><path d=\"M64,88c-13.234,0-24-10.767-24-24c0-13.234,10.766-24,24-24s24,10.766,24,24C88,77.233,77.234,88,64,88z M64,48c-8.822,0-16,7.178-16,16s7.178,16,16,16c8.822,0,16-7.178,16-16S72.822,48,64,48z\" fill=\"#000\"><\/path><\/g><g><circle cx=\"89.5\" cy=\"38.5\" fill=\"#000\" r=\"5.5\"><\/circle><\/g><\/g><\/svg><\/span><\/a><\/div><div class=\"heateorSssClear\"><\/div><\/div><div class='heateorSssClear'><\/div><p>How to Fix 502\/504 Gateway Errors A 502 Bad Gateway or 504 Gateway Timeout usually means the web server isn\u2019t getting a valid response from the backend application. The site may still be up, but the connection between the proxy and the app is failing. This can happen when the backend service is down, the [&hellip;]<\/p>\n","protected":false},"featured_media":0,"template":"","meta":[],"cs_category":[1000,1010],"class_list":["post-54750","cs_article","type-cs_article","status-publish","hentry","cs_category-compute","cs_category-cs-articles"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v20.10 (Yoast SEO v24.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Fix 502\/504 Gateway Errors - AccuWeb Cloud<\/title>\n<meta name=\"description\" content=\"Fix 502 Bad Gateway and 504 Gateway Timeout errors easily. Learn how to check server status, application logs, PHP-FPM, resources, and proxy settings.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/accuweb.cloud\/resource\/cs\/how-to-fix-502-504-gateway-errors\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Fix 502\/504 Gateway Errors\" \/>\n<meta property=\"og:description\" content=\"Fix 502 Bad Gateway and 504 Gateway Timeout errors easily. Learn how to check server status, application logs, PHP-FPM, resources, and proxy settings.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/accuweb.cloud\/resource\/cs\/how-to-fix-502-504-gateway-errors\" \/>\n<meta property=\"og:site_name\" content=\"AccuWeb Cloud\" \/>\n<meta property=\"og:image\" content=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-2-Check-the-web-server.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2048\" \/>\n\t<meta property=\"og:image:height\" content=\"784\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/accuweb.cloud\/resource\/cs\/how-to-fix-502-504-gateway-errors\",\"url\":\"https:\/\/accuweb.cloud\/resource\/cs\/how-to-fix-502-504-gateway-errors\",\"name\":\"How to Fix 502\/504 Gateway Errors - AccuWeb Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/accuweb.cloud\/resource\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/accuweb.cloud\/resource\/cs\/how-to-fix-502-504-gateway-errors#primaryimage\"},\"image\":{\"@id\":\"https:\/\/accuweb.cloud\/resource\/cs\/how-to-fix-502-504-gateway-errors#primaryimage\"},\"thumbnailUrl\":\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-2-Check-the-web-server.png\",\"datePublished\":\"2026-07-21T06:51:21+00:00\",\"description\":\"Fix 502 Bad Gateway and 504 Gateway Timeout errors easily. Learn how to check server status, application logs, PHP-FPM, resources, and proxy settings.\",\"breadcrumb\":{\"@id\":\"https:\/\/accuweb.cloud\/resource\/cs\/how-to-fix-502-504-gateway-errors#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/accuweb.cloud\/resource\/cs\/how-to-fix-502-504-gateway-errors\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/accuweb.cloud\/resource\/cs\/how-to-fix-502-504-gateway-errors#primaryimage\",\"url\":\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-2-Check-the-web-server.png\",\"contentUrl\":\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-2-Check-the-web-server.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/accuweb.cloud\/resource\/cs\/how-to-fix-502-504-gateway-errors#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/accuweb.cloud\/resource\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"CS Articles\",\"item\":\"https:\/\/accuweb.cloud\/resource\/cs\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"How to Fix 502\/504 Gateway Errors\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/accuweb.cloud\/resource\/#website\",\"url\":\"https:\/\/accuweb.cloud\/resource\/\",\"name\":\"AccuWeb Cloud\",\"description\":\"Cutting Edge Cloud Computing\",\"publisher\":{\"@id\":\"https:\/\/accuweb.cloud\/resource\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/accuweb.cloud\/resource\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/accuweb.cloud\/resource\/#organization\",\"name\":\"AccuWeb.Cloud\",\"url\":\"https:\/\/accuweb.cloud\/resource\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/accuweb.cloud\/resource\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/04\/accuwebcloud_logo_black_tagline.jpg\",\"contentUrl\":\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/04\/accuwebcloud_logo_black_tagline.jpg\",\"width\":156,\"height\":87,\"caption\":\"AccuWeb.Cloud\"},\"image\":{\"@id\":\"https:\/\/accuweb.cloud\/resource\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to Fix 502\/504 Gateway Errors - AccuWeb Cloud","description":"Fix 502 Bad Gateway and 504 Gateway Timeout errors easily. Learn how to check server status, application logs, PHP-FPM, resources, and proxy settings.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/accuweb.cloud\/resource\/cs\/how-to-fix-502-504-gateway-errors","og_locale":"en_US","og_type":"article","og_title":"How to Fix 502\/504 Gateway Errors","og_description":"Fix 502 Bad Gateway and 504 Gateway Timeout errors easily. Learn how to check server status, application logs, PHP-FPM, resources, and proxy settings.","og_url":"https:\/\/accuweb.cloud\/resource\/cs\/how-to-fix-502-504-gateway-errors","og_site_name":"AccuWeb Cloud","og_image":[{"width":2048,"height":784,"url":"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-2-Check-the-web-server.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/accuweb.cloud\/resource\/cs\/how-to-fix-502-504-gateway-errors","url":"https:\/\/accuweb.cloud\/resource\/cs\/how-to-fix-502-504-gateway-errors","name":"How to Fix 502\/504 Gateway Errors - AccuWeb Cloud","isPartOf":{"@id":"https:\/\/accuweb.cloud\/resource\/#website"},"primaryImageOfPage":{"@id":"https:\/\/accuweb.cloud\/resource\/cs\/how-to-fix-502-504-gateway-errors#primaryimage"},"image":{"@id":"https:\/\/accuweb.cloud\/resource\/cs\/how-to-fix-502-504-gateway-errors#primaryimage"},"thumbnailUrl":"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-2-Check-the-web-server.png","datePublished":"2026-07-21T06:51:21+00:00","description":"Fix 502 Bad Gateway and 504 Gateway Timeout errors easily. Learn how to check server status, application logs, PHP-FPM, resources, and proxy settings.","breadcrumb":{"@id":"https:\/\/accuweb.cloud\/resource\/cs\/how-to-fix-502-504-gateway-errors#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/accuweb.cloud\/resource\/cs\/how-to-fix-502-504-gateway-errors"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/accuweb.cloud\/resource\/cs\/how-to-fix-502-504-gateway-errors#primaryimage","url":"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-2-Check-the-web-server.png","contentUrl":"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2026\/07\/Step-2-Check-the-web-server.png"},{"@type":"BreadcrumbList","@id":"https:\/\/accuweb.cloud\/resource\/cs\/how-to-fix-502-504-gateway-errors#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/accuweb.cloud\/resource\/"},{"@type":"ListItem","position":2,"name":"CS Articles","item":"https:\/\/accuweb.cloud\/resource\/cs"},{"@type":"ListItem","position":3,"name":"How to Fix 502\/504 Gateway Errors"}]},{"@type":"WebSite","@id":"https:\/\/accuweb.cloud\/resource\/#website","url":"https:\/\/accuweb.cloud\/resource\/","name":"AccuWeb Cloud","description":"Cutting Edge Cloud Computing","publisher":{"@id":"https:\/\/accuweb.cloud\/resource\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/accuweb.cloud\/resource\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/accuweb.cloud\/resource\/#organization","name":"AccuWeb.Cloud","url":"https:\/\/accuweb.cloud\/resource\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/accuweb.cloud\/resource\/#\/schema\/logo\/image\/","url":"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/04\/accuwebcloud_logo_black_tagline.jpg","contentUrl":"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/04\/accuwebcloud_logo_black_tagline.jpg","width":156,"height":87,"caption":"AccuWeb.Cloud"},"image":{"@id":"https:\/\/accuweb.cloud\/resource\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/accuweb.cloud\/resource\/wp-json\/wp\/v2\/cs_article\/54750","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/accuweb.cloud\/resource\/wp-json\/wp\/v2\/cs_article"}],"about":[{"href":"https:\/\/accuweb.cloud\/resource\/wp-json\/wp\/v2\/types\/cs_article"}],"wp:attachment":[{"href":"https:\/\/accuweb.cloud\/resource\/wp-json\/wp\/v2\/media?parent=54750"}],"wp:term":[{"taxonomy":"cs_category","embeddable":true,"href":"https:\/\/accuweb.cloud\/resource\/wp-json\/wp\/v2\/cs_category?post=54750"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}