If you have a large WordPress setup or a server with limited resources, then you will often see the “504 Gateway Time-out” error.

You can follow the steps given below to increase the timeout value. PHP default is 30s.

Changes in php.ini

If you want to change max execution time limit for php scripts from 30 seconds (default) to 300 seconds.

vim /etc/php5/fpm/php.ini

Set…

max_execution_time = 300

In Apache, applications running PHP as a module above would have suffice. But in our case we need to make this change at 2 more places.

Changes in PHP-FPM

This is only needed if you have already un-commented request_terminate_timeout parameter before. It is commented by default, and takes value of max_execution_time found in php.ini

Edit…

vim /etc/php5/fpm/pool.d/www.conf

Set…

request_terminate_timeout = 300

Changes in Nginx Config

To increase the time limit for example.com by

vim /etc/nginx/sites-available/example.com
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_read_timeout 300;
}

If you want to increase time-limit for all-sites on your server, you can edit main nginx.conf file:

vim /etc/nginx/nginx.conf

Add following in http{..} section

http {
#...
fastcgi_read_timeout 300; 
#...
}

Reload PHP-FPM & Nginx

Don’t forget to do this so that changes you have made will come into effect:

service php5-fpm reload
service nginx reload

More

 

Increase PHP script execution time with Nginx的更多相关文章

  1. unity 脚本执行顺序设置 Script Execution Order Settings

     通过Edit->Project Settings->Script Execution Order打开MonoManager面板  或者选择任意脚本在Inspector视图中点击Execu ...

  2. [Javascript]2. Improve you speed! Script Execution

    Let's take a closer look at how a browser retrieves and acts on scripts.modern browser can parallel ...

  3. Unity3D Script Execution Order ——Question

    我 知道 Monobehaviour 上的 那些 event functions 是 在主线程 中 按 顺序调用的.这点从Manual/ExecutionOrder.html 上的 一张图就可以看出来 ...

  4. 配置nginx php上传大文件

    配置nginx php上传大文件: 1. 修改PHP配置文件中的三项:vim /usr/local/php/etc/php.ini 1.file_uploads 设为On,允许通过HTTP上传文件 2 ...

  5. nginx(五)nginx与php的安装配置

    经过前面学习,对nginx有个大概的了解,来配置LNMP;只要是在系统安装过程中选择安装比较齐全的包,基本上系统都能满足安装要求,下面是我一个一个测试的,基本上全部安装所需的库文件,放心安装: [ro ...

  6. LINUX下安装PHP(CGI模式)和NGINX[转]

    安装所需依赖 yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freety ...

  7. LNMP搭建(CentOS 6.3+Nginx 1.2.0+PHP 5.3.15(fpm)+ MySQL 5.5.35)

    Nginx (“engine x”) 是一个高性能的 HTTP 和反向代理服务器,也是一个 IMAP/POP3/SMTP 代理服务器. Nginx 是由 Igor Sysoev 为俄罗斯访问量第二的 ...

  8. linux+nginx+mysql+php高性能服务器搭建

    1.安装基础包 yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freet ...

  9. Linux中Nginx安装与配置详解

    转载自:http://www.linuxidc.com/Linux/2016-08/134110.htm Linux中Nginx安装与配置详解(CentOS-6.5:nginx-1.5.0). 1 N ...

随机推荐

  1. Electrom will-download pause function

    1.code from github url-link: https://github.com/electron/electron/issues/7712 // to store downloadIt ...

  2. yyyy-MM-dd 转换为年月日

      yyyy-MM-dd 转换为年月日   先用parse转成date型,再用format转成string. Date date = new SimpleDateFormat("yyyy-M ...

  3. 百度地图API自动定位和3种导航

    <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...

  4. async.waterfall

    [async.waterfall] if any of the tasks pass an error to their own callback, the next function is not ...

  5. lvm磁盘分区

    初始分区情况见下: 创建lvm类型磁盘 创建卷pv 添加pv到vg中,vg名vgroup0 创建lv lvcreate -L 2g -n zookeeper vgroup0 在vg vgroup0中创 ...

  6. ubuntu下java的安装即使用

    1.首先在官方网站(点击可以下载)下载最新的JDK,要选用self extracting installer 2.在/usr/下新建java目录,把下载的文件放到这个目录下 sudo mkdir /u ...

  7. nodejs中.npmrc文件的内容

    . nodejs安装后,使用npm安装模块的时候我出现了一个错误. getaddrinfo ENOTFOUND xxx 主要是这个配置文件的问题.搞不清楚.直接打开把文件内容删除变成 npmrc文件内 ...

  8. C语言之栈区、堆区

    一 局部变量存放在栈区中,函数调用结束后释放内存空间. #include "stdio.h"; #include "stdlib.h"; int *getNum ...

  9. 【Android端 adb相关】adb相关总结

    一.什么是adb? adb的全称是:Android Debug Bridge,adb命令的构成是三部分,分别是:服务器.客户端.后台程序: (1)客户端:一个在PC上运行的客户端.可以通过shell端 ...

  10. Laravel常用命令行中文版

    1.生成控制器 php artisan make:controller ArticleController 对应的会在app/http/controllers下面生成ArticleController ...