前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >配置nginx php上传大文件

配置nginx php上传大文件

作者头像
sunsky
发布2020-08-19 16:14:39
2.2K0
发布2020-08-19 16:14:39
举报
文章被收录于专栏:sunskysunsky

配置nginx php上传大文件:

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

1.file_uploads 设为On,允许通过HTTP上传文件 2.upload_tmp_dir 文件上传至服务器时用于临时存储的目录,如果没指定,系统会使用默认的临时文件夹(我的机器是/tmp)。 3.upload_max_filesize 允许上传文件大小的最大值,默认为2M。 4.post_max_size Php可接收的post数据的最大值(包括表单里的所有值的总合),默认为8M。 5.memory_limit 每个php所最占的最大内存数,这个值要大于允许上传的文件大小。 6.max_execution_time 每个php运行的最长时间(秒),默认30秒。 7.max_input_time Php解析POST/GET数据的最长时间(秒),默认60秒。This sets the maximum time in seconds a scripts is allowed to parse input data, like POST and GET.It is measured from the mement of receiving all data on the server to the start of script execution.

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

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

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

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

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2018-07-24 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 配置nginx php上传大文件:
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档