![]() ![]() The server then responds to this with an answer that includes a 504 status code, which for example might include information on a successful processing (HTTP 200), or else information on its failure, in the case of a 504 error. This exchange occurs via notifications through which the client defines a HTTP request. For this reason, HTTP communicates the website’s hypertext, which the client software can in turn convert into text, images, etc. ![]() Operating on the application layer, it initiates communication between the client – normally an internet browser – and the corresponding web server hosting the desired content. Increasing the buffers and timeouts gives NGINX / PHP-FPM space to work, particularly if you have any heavy PHP scripts.The Hypertext Transfer Protocol is one of the most important protocols when it comes to the transfer of web content. Increase the timeouts and buffers between NGINX and PHP-FPM. To solve this php-fpm issue, we can tweak Nginx and PHP-FPM configurations. If the process is stopped, this is most likely because your server has run out of memory, although you can try to restart it by running this command: $ sudo systemctl start php7.2-fpmīut, if you see that php-fpm process is running, it means php-fpm could not respond in time and Nginx is unable to communicate with it, hence the issue. In the latest CentOS and Ubuntu, you can invoke this command to see where the process should be run from: $ sudo systemctl list-unit-files | grep fpm The next step is to find what pservice should run on port 9000, you can run this command: $ sudo grep -rl 9000 /etcĪs we can see in the picture, it seems that php-fpm7.2 should run to process the PHP files. This is why you see the 502 bad gateway error when accessing your WordPress website. If the shell command does not print anything on the screen, then the process is dead. If a process is running on port 9000, you should see something like this after invoking the shell command. To check what is running on port 9000, we can issue this shell command: $ sudo netstat -pltn | grep 9000 How to Fix 502 Gateway Error in Nginxįirst, you need to investigate your Nginx server block and check what the upstream server is.įor example, we have a WordPress website at, and this is the Nginx server block configuration.Īccording to the configuration, as shown in the picture above, the website’s PHP files are processed by fastcgi running on port 9000. However, there are some general troubleshooting steps that you can follow to get it solved.įor example, if you use Nginx as the webserver and you encounter this issue, it could be that Nginx is unable to communicate with the upstream server, this upstream server could be PHP-FPM or other application that you want to access through Nginx, like Odoo, NodeJS, etc. It can be a tricky investigation to locate what and where is the process which caused the issue. If you are seeing a 502 bad gateway error on a website, it means that the origin server sent out an invalid response to another server that acted as a gateway or proxy. In more technical words, A 502 Bad Gateway means that the proxy (gateway) server wasn’t able to get a valid or any response from the upstream server. The 502 Bad Gateway error is an HTTP status code that means that one server received an invalid response from another server.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |