当前位置:  -> 首页 -> PHP在NGINX以FAST-CGI方式运行上传大文件时的参数配置

上一篇 | 下一篇
PHP在NGINX以FAST-CGI方式运行上传大文件时的参数配置
作者:洛羽叶  点击率:2835  发布时间:2012-05-18

PHP在NGINX以FAST-CGI方式运行上传大文件时的参数配置

首先要用PHP 生成临时文件,然后在上传到FTP服务器。

1.PHP配置文件PHP.INI

 ; Whether to allow HTTP file uploads.
 file_uploads = On

 ; Temporary directory for HTTP uploaded files (will use system default if not
 ; specified).
 upload_tmp_dir =/tmp

 ; Maximum allowed size for uploaded files.
 upload_max_filesize = 30M

 ; Maximum size of POST data that PHP will accept.
 post_max_size = 30M

2.NGINX配置
 client_max_body_size 30m;
 PHP程序的执行时间超过了NGINX的等待时间,可以增加nginx.conf配置文件中FastCGI的timeout时间:
 fastcgi_connect_timeout 300;
 fastcgi_send_timeout 300;
 fastcgi_read_timeout 300;

3.PHP-FPM配置
 在 php.ini 中,参数 max_execution_time设置 PHP 脚本的最大执行时间,在 php-cgi 中,真正能够控制 PHP 脚本最大执行时间的是php-fpm.conf配置文件中的以下参数:
 php-fpm.conf
  The timeout (in seconds) for serving a single request after which the worker process will be terminated Should be used when 'max_execution_time' ini option does not stop script execution for some reason.
  '0s' means 'off'
  <value name="request_terminate_timeout">0s</value>

 

标签: PHP NGINX
引用地址:本站原创
   站点首页      技术人生      旅途足迹      我要留言      友情链接      关于站长   
[本站统计]
在线人数:15
今日访问:536
总访问量:1936367
Copyright 2006-2022 EasyWeb 1.6 订阅 All Rights Reserved
粤ICP备08028977号-1
www.luoriver.com
Created by WWH in 2006