一聚教程网:一个值得你收藏的教程网站

热门教程

Nginx下配置PHP文件上传大小限制

时间:2022-06-30 18:40:34 编辑:袖梨 来源:一聚教程网

1. 修改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)

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

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

 3. 重启PHP:/etc/init.d/php-fpm restart

4. 平滑重启Nginx:/usr/local/nginx/sbin/nginx -s reload

热门栏目