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 ...
随机推荐
- clone()与image和 cloneTo()
Mat image = imread("1.png" ) ; Mat image1 ; Mat image1(image) ;//仅是创建了Mat的头部分,image1与image ...
- notepad++查看二进制文件
1.进入以下网址去下载 https://sourceforge.net/projects/npp-plugins/files/Hex%20Editor/Hex%20Editor%20Plugin%20 ...
- maven 配置 阿里仓库
<mirror><id>nexus-aliyun</id><mirrorOf>central</mirrorOf><name>N ...
- pecan API调用
1.在PasteDeploy部署caesar-api服务时,setup_app中建立app,app中设置hooks,hooks负责加载conf配置文件和数据库连接 self.storage_conne ...
- 3. Longest Substring Without Repeating Characters (ASCII码128个,建立哈西表)
Given a string, find the length of the longest substring without repeating characters. For example, ...
- Shell教程 之printf命令
上一章节我们学习了 Shell 的 echo 命令,本章节我们来学习 Shell 的另一个输出命令 printf. printf 命令模仿 C 程序库(library)里的 printf() 程序. ...
- 承载地图的div如果隐藏再显示,则定位时会定位到页面左上角
承载地图的div如果隐藏再显示,则定位时会定位到页面左上角. 解决方法:不隐藏,改变div的高度.在div上利用z-index加一个新的不透明的div.
- 速卖通API开发步骤
http://gw.api.alibaba.com/dev/doc/intl/sys_auth.htm?ns=aliexpress.open#concept 关键字段说明 1.appKey和appSe ...
- QT注意事项(持续更新...)
同样要注意new和delete的问题: is not a member of QApplication:这个错误可能是找不到信号或槽函数: 想用到信号槽,必须至少继承QObject类,并在类第一行写上 ...
- gradle项目与maven项目互转
maven to gradle 在maven项目根目录下执行命令: gradle init --type pom 当然你得先下载Gradle,配置完环境变量. gradle to maven grad ...