nginx 上传文件大小限制
使用nginx+php+mysql,上传大于1M的文件时,总是无法上传,修改了php.ini 也不奏效。后来查阅资料后,了解nginx 配置中client_max_body_size 值默认是1M。
解决方案如下
修改nginx.conf
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { root /home/www/htdocs; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /home/www/htdocs$fastcgi_script_name; include fastcgi_params; client_max_body_size 35m; #客户端上传文件大小设为35M client_body_temp_path /home/www/nginx_temp; #设置临时目录 }
浙公网安备 33010602011771号