How do I fix NGINX 502 Bad Gateway?

How to Fix a 502 Bad Gateway Error

  1. Reload the page.
  2. Look for server connectivity issues.
  3. Check for any DNS changes.
  4. Sift through your logs.
  5. Fix faulty firewall configurations.
  6. Comb through your website’s code to find bugs.
  7. Contact your host.

How do I fix 502 Gateway Timeout?

You can fix this error from your side by doing the following steps.

  1. Clearing cache of the web browser.
  2. Delete your browser’s cookies.
  3. Start your browser in Safe Mode.
  4. Try another browser.
  5. Restart your computer.
  6. Restart your networking equipment such as modem, router, switches.

Why is my 502 Bad Gateway NGINX?

A 502 Bad Gateway Error means that the web server you’ve connected to is acting as a proxy for relaying information from another server, but it has gotten a bad response from that other server. It’s possible the server is overloaded or there are network issues between the two servers, and it’s just a temporary problem.

What is the error 502 bad gateway?

The HyperText Transfer Protocol (HTTP) 502 Bad Gateway server error response code indicates that the server, while acting as a gateway or proxy, received an invalid response from the upstream server.

How do I fix Error 502 Gateway?

Troubleshoot a 502 error message

  1. Refresh the page.
  2. Start a new browser session or load the site on a different browser.
  3. Restart your computer and networking equipment.
  4. Clear your cache and cookies.
  5. Change your DNS server.
  6. Contact the website administrator or your internet service provider.

How do I get rid of error 502?

Why is my Nginx server saying 502 Bad Gateway?

Maintaining a server is hard. You have to deal with all the upgrades, security patches and the occassional server errors (aka errors from hell). One such common error in Nginx servers is “ 502 Bad Gateway “. 3 word error message – because Nginx doesn’t love you. That’s why. The error message is cryptic.

What is the default timeout for Nginx for PHP?

The default NGINX timeout is 60 seconds; if you’ve raised your PHP-FPM timeout above 60 seconds, NGINX will return a 504 Gateway Timeout error if your PHP application hasn’t responded in time. You can prevent this by also raising your NGINX timeout.

What is an HTTP status code error in Nginx?

Such type of error is referred to as an HTTP Status Code Error. It generally occurs at the gateway. Where gateway is an access point, a bridge communicates between the two servers. In this case, the gateway can be a service or application that is working and receiving requests from Nginx web server.

Why is my Nginx not responding to PHP-FPM?

If NGINX is unable to communicate with PHP-FPM for any of these reasons, it will respond with a 502 error, noting this in its access log ( /var/log/nginx/access.log) as shown in this example: NGINX’s access log doesn’t explain the cause of a 502 error, but you can consult its error log ( /var/log/nginx/error.log) to learn more.

Share this post