您的位置:首页 > 运维架构 > Nginx

Nginx与PHP的文件上传大小限制(转载)

2017-10-13 18:07 281 查看
亲测可用,所以转载一下.

转载自:http://www.cnblogs.com/farwish/p/3961819.html

修改PHP配置文件中的三项:vim /usr/local/php/etc/php.ini

  (1)post_max_size = 50M      #PHP可接受的最大POST数据

  (2)upload_max_filesize = 50M   #文件上传允许的最大值

  (3)max_execution_time = 300   #每个脚本的最大执行时间,秒钟(0则不限制,不建议设0)

修改Nginx配置文件:vim /usr/local/nginx/conf/nginx.conf (如果忘了配置文件的具体位置,可以使用 locate nginx.conf 查找)

  (1)client_max_body_size 50m   #客户端最大上传大小 50M

重启PHP:

/etc/init.d/php-fpm restart


平滑重启Nginx:

/usr/local/nginx/sbin/nginx -s reload
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  nginx php