Increase Request Timeout in NGINX for a Proxied Server In this article, I will show how to fix the 504 Gateway Timeout error by increasing the request timeout in the NGINX web server. However, it didn’t take long before users uploading bulky files started getting a 504 Gateway Timeout error from NGINX.Īre you getting the same error? Don’t worry, I have got you covered. One of the key features of the application is support for data imports using excel templates. I recently deployed a Node.js web application with NGINX as a reverse proxy server for it. Increasing the buffers and timeouts gives NGINX / PHP-FPM space to work, particularly if you have any heavy PHP scripts.I use NGINX a lot. 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 |