Nginx+php上传大文件
跳到导航
跳到搜索
nignx 配置
server { listen 80; server_name 1.cn; root /web; charset utf-8; index Index.php index.php index.htm index.html; client_max_body_size 1024m; #小写的 #client_max_body_size 1024M;
php.ini php 配置
file_uploads = On ; Temporary directory for HTTP uploaded files (will use system default if not ; specified). ; http://php.net/upload-tmp-dir ;upload_tmp_dir = upload_tmp_dir="/data/tmp/" ; Maximum allowed size for uploaded files. ; http://php.net/upload-max-filesize upload_max_filesize = 1024M ; Maximum number of files that can be uploaded via a single request max_file_uploads = 20 ;;;;;;;;;;;;;;;;;; ; Fopen wrappers ; ;;;;;;;;;;;;;;;;;; ; Whether to allow the treatment of URLs (like http:// or ftp://) as files. ; http://php.net/allow-url-fopen allow_url_fopen = On
解说
参数 设置 说明 file_uploads on 是否允许通过HTTP上传文件的开关。默认为ON即是开 upload_tmp_dir – 文件上传至服务器上存储临时文件的地方,如果没指定就会用系统默认的临时文件夹 upload_max_filesize 8m 望文生意,即允许上传文件大小的最大值。默认为2M post_max_size 8m 指通过表单POST给PHP的所能接收的最大值,包括表单里的所有值。默认为8M
参考
http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size
nginx修改上传文件大小限制 http://blog.csdn.net/bruce128/article/details/9665503