今天产品那边有个需求:需要在discuz上传视频文件,文件大小超过100M,在discuz后台设置了上传附件大小后,出现server io error的错误。
第一感觉就是php那边的文件上传做了限制,对php.ini 配置文件做了相应修改: - max_execution_time = 600 ; Maximum execution time of each script, in seconds
- max_input_time = 600 ; Maximum amount of time each script may spend parsing request data
- memory_limit = 512M ; Maximum amount of memory a script may consume (8MB)
- post_max_size = 500M
- upload_max_filesize = 500M
复制代码 重启php-fpm,可以上传大于50M的文件,但是发现当上传文件大于100M时就又出现server io error。觉得会不会是nginx做了限制,果不其然,nginx做了上传附件大小为100M,修改相应配置后,重启nginx,上传大于100M的文件正常了。- client_max_body_size 500m;
复制代码就是这个client_max_body_size捣蛋鬼,nginx默认设置为1M。 当上传文件大小被限制时,修改php.ini配置无效后,可以尝试修改nginx client_max_body_size 配置项。
|