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 ...
随机推荐
- php分割最后一个逗号后面的字符
$str = 'a/b/c/d/e/f'; echo preg_replace('/.*\//','',$str); echo preg_replace('/.*,/','',$str);最后 ...
- php原样输出被编译过的html(适用于一些保存编辑器的内容)
有时候有些编辑器写进数据库时尖括号或双引号被编译过,这时候输入来就是处理一下,不然得不到原样的 输入用 html_entity_decode($content)就可以了,有些直接存完整html的,输 ...
- JXS In Depth
[JXS In Depth] 1.Spread Attributes If you already have props as an object, and you want to pass it i ...
- css3修改滚动条样式
/*滚动条整体样式*/ /*高宽分别对应横竖滚动条的尺寸*/ .content-box::-webkit-scrollbar{ width: 4px; height: 4px; } /*滚动条里面小方 ...
- 让Ubuntu可以压缩/解压缩RAR文件
ubuntu刚安装的时候是不能解压rar文件的,只有在安装了解压工具之后,才可以解压. 安装:sudo apt-get install unrar卸载:sudo apt-get remove unra ...
- 前端 websocket用法
<!DOCTYPE html> <meta charset="utf-8" /> <title>WebSocket Test</title ...
- c#控件的动画显示效果
1. 缘由: 项目中任务完成有个提示,需要以动画效果展示,其效果当如下图: 此为老项目为Delphi所写,改用c#实现,此效果做些设计.本也不难,小技而已,但为易于扩展,写了个静态类实现. 2. A ...
- EasyUI 在Tab页用button打开新Tab
标签: <a href="javascript:void(0)" class="easyui-linkbutton" id="ipConfig& ...
- Spring Cloud入门教程(二):客户端负载均衡(Ribbon)
对于大型应用系统负载均衡(LB:Load Balancing)是首要被解决一个问题.在微服务之前LB方案主要是集中式负载均衡方案,在服务消费者和服务提供者之间又一个独立的LB,LB通常是专门的硬件,如 ...
- swift - 画图截取图片 - 保存相册
1.图片截取 func test(addView:UIView) -> UIImage?{ UIGraphicsBeginImageContextWithOptions(CGSize(width ...