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. ggplot2

    应用与: http://www.cnblogs.com/batteryhp/p/5232353.html 由于python中matplotlib包的画图功能比较基本,不怎么炫酷,所以想用R中的ggpl ...

  2. cakePHP 分页栏

    <div class="page"><?php if ($total > 1) echo $this->element('page_list', ar ...

  3. async.series

    [async.series] series适用于顺序执行异步且前后无关联的调用.对于顺序执行异步且前后有叛逆的调用,则需要使用waterfall. If any functions in the se ...

  4. python-ceilometerclient命令行(1)

    1.导入模块,可以动态获取模块中方法并调用,其功能与from...import...一致 2. callback = getattr(actions_module, attr) 从模块中获取方法. 调 ...

  5. 解题4(NumberToEnglish )

    题目描述 Jessi初学英语,为了快速读出一串数字,编写程序将数字转换成英文: 如22:twenty two,123:one hundred and twenty three. 说明: 数字为正整数, ...

  6. java定义object数组(可以存储String或int等多种类型)

    需求| 想在数组中既有String类型又有int等类型,所以需要定义数组为Object类型   背景| 现在有一个字符串params,需要对其进行逗号分隔赋值到数组里,这时遇到了个问题,即使直接定义的 ...

  7. Pandas操作数据库及保存csv

    数据的保存 import pandas as pd import numpy as np from pandas import Series col_db = [['one',1,2,3,4,np.n ...

  8. HttpSession 和 HttpSession

    说cookie机制采用的是在客户端保持状态的方案,而session机制采用的是在服务器端保持状态的方案.

  9. 解决 HDFS 开发 java.lang.IllegalArgumentException: java.net.UnknownHostException: hadoop000

    出现这种问题多半是windows找不到linux主机所以在 这个路径下的hosts加上linux ip地址,主机名就可以了

  10. HTTP 基础

    HTTP简介 HTTP协议是Hyper Text Transfer Protocol(超文本传输协议)的缩写,是用于从万维网(WWW:World Wide Web )服务器传输超文本到本地浏览器的传送 ...