Increase PHP script execution time with Nginx
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
- How to increase file-upload size limit in PHP-Nginx
- More optimization tips for WordPress-Nginx setup
Increase PHP script execution time with Nginx的更多相关文章
- unity 脚本执行顺序设置 Script Execution Order Settings
通过Edit->Project Settings->Script Execution Order打开MonoManager面板 或者选择任意脚本在Inspector视图中点击Execu ...
- [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 ...
- Unity3D Script Execution Order ——Question
我 知道 Monobehaviour 上的 那些 event functions 是 在主线程 中 按 顺序调用的.这点从Manual/ExecutionOrder.html 上的 一张图就可以看出来 ...
- 配置nginx php上传大文件
配置nginx php上传大文件: 1. 修改PHP配置文件中的三项:vim /usr/local/php/etc/php.ini 1.file_uploads 设为On,允许通过HTTP上传文件 2 ...
- nginx(五)nginx与php的安装配置
经过前面学习,对nginx有个大概的了解,来配置LNMP;只要是在系统安装过程中选择安装比较齐全的包,基本上系统都能满足安装要求,下面是我一个一个测试的,基本上全部安装所需的库文件,放心安装: [ro ...
- LINUX下安装PHP(CGI模式)和NGINX[转]
安装所需依赖 yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freety ...
- 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 为俄罗斯访问量第二的 ...
- linux+nginx+mysql+php高性能服务器搭建
1.安装基础包 yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freet ...
- Linux中Nginx安装与配置详解
转载自:http://www.linuxidc.com/Linux/2016-08/134110.htm Linux中Nginx安装与配置详解(CentOS-6.5:nginx-1.5.0). 1 N ...
随机推荐
- Global Illumination
[Global Illumination] Global Illumination (GI) is a system that models how light is bounced off of s ...
- Windows 2012设置允许单个用户连接多个会话的方法
WINDOWS 2012 服务器默认只允许单个用户连接一个远程桌面会话,如果已有连接登陆,另外的连接再登陆会踢掉之前的连接.如果需要两个远程桌面同时连接 找到:HKEY_LOCAL_MACHINE\S ...
- JMeter学习(二十八)内存溢出解决方法(转载)
转载自 http://www.cnblogs.com/yangxia-test 使用jmeter进行压力测试时遇到一段时间后报内存溢出outfmenmory错误,导致jmeter卡死了,先尝试在jme ...
- V4 V7 V13支持包的区别(转)
三者均为支持包,可以让低版本系统使用高版本特性,支持最小版本有差异 V4支持1.6以上 V7支持2.1以上 V13支持3.2以上 V7依赖V4 转自:
- postman使用方法
Postman sending requests 打开Postman,可以看到界面分成左右两个部分,右边是我们后头要讲的collection,左边是现在要讲的request builder.在requ ...
- 获取txt里面的内容
import flash.net.URLLoader; import flash.net.URLRequest; import flash.events.Event; var txtLoad:URLL ...
- NumPy 高级索引
NumPy 高级索引 NumPy 比一般的 Python 序列提供更多的索引方式.除了之前看到的用整数和切片的索引外,数组可以由整数数组索引.布尔索引及花式索引. 整数数组索引 以下实例获取数组中(0 ...
- 什么是PCM?它和.wav文件是什么关系?
PCM(Pulse Code Modulation----脉码调制录音).所谓PCM录音就是将声音等模拟信号变成符号化的脉冲列,再予以记录.PCM信号是由[1].[0]等符号构成的数字信号,而未经过任 ...
- Chrome控制台格式化输出
一 格式化输出文字 console.log('%c你好','color:green;'); console.log('%c你好%c啊','color:green;','color:blue;'); 二 ...
- 安装routeos
直接开机,会看到: 选择全部安装即可,按a.i即可. 默认账号admin,默认没有密码 基本使用 可通过/ip,/interface等可以进去不同子功能模块,可进行print,add,remove等操 ...