Home  >  Article  >  Backend Development  >  叫你如何修改Nginx与PHP的文件上传大小限制_php技巧

叫你如何修改Nginx与PHP的文件上传大小限制_php技巧

WBOY
WBOYOriginal
2016-05-16 20:36:141008browse

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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn