Prevent nginx 504 Gateway timeout using PHP set_time_limit()

后端 未结 10 1889
醉话见心
醉话见心 2020-11-29 15:58

I am getting 504 timeouts message from nginx when my PHP script is running longer than usual. set_time_limit(0) does not seem to prevent that! Does it not work

10条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-29 16:43

    Try this link, it has a better solution on how to fix this. So the steps are:

    1. Open your nginx.conf file located in /etc/nginx directory.
    2. Add this below piece of code under http { section:

      client_header_timeout 3000;
      client_body_timeout 3000;
      fastcgi_read_timeout 3000;
      client_max_body_size 32m;
      fastcgi_buffers 8 128k;
      fastcgi_buffer_size 128k;
      

      Note: If its already present , change the values according.

    3. Reload Nginx and php5-fpm.

      $ service nginx reload
      $ service php5-fpm reload
      

      If the error persists, consider increasing the values.

提交回复
热议问题