Maximum execution time of each script, in seconds http://php.net/max-execution-time Note: This directive is hardcoded to 0 for the CLI SAPI
首先,您需要通过键入vi命令来编辑
`/etc/nginx/nginx.conf
文件:
$ sudo vi /etc/nginx/nginx.conf
在http(服务器/位置)部分中,添加以下指令以将最大允许大小设置为10MB:
client_max_body_size 10M;
测试nginx配置是否有错误 运行以下命令:
$ sudo nginx -t
示例输出:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful 如果没有错误意味着,请重新启动nginx Web服务器。
$ sudo systemctl reload nginx
或
$ sudo service nginx reload
通过上载大文件验证配置。确保你也看到nginx错误日志:
$ sudo tail -f /var/log/nginx/error.log
如何配置php接受上传高达10MB
编辑您的php.ini文件并确保其中包含以下两行:
$ sudo vi /etc/php.ini
按如下方式追加或编辑:
upload_max_filesize = 10M
post_max_size = 10M
保存并关闭文件。重新启动Nginx的PHP-FPM服务:
$ sudo systemctl start php-fpm
OR
$ sudo /etc/init.d/php-fpm restart
或
# /usr/local/etc/rc.d/php-fpm restart
现在上传文件并进行测试。
检查配置
简而言之,您需要使用grep命令 / egrep command / tail命令在nginx.conf和php.ini中使用以下行:
$ grep client_max_body_size /etc/nginx/options.conf
$ egrep 'upload_max_filesize|post_max_size' /etc/php/7.0/fpm/conf.d/99-custom.ini
$ tail -f /var/log/nginx/error.log
$ tail -f /var/log/nginx/php-fpm-error.log
最新评论
密码:blog.sirliu.com
本内容密码:blog.sirliu.com 最新整理的文章在这里喔:https://blog.sirliu.com/2018/11/shell_lian_xi_ti.html