前言
前段时间有网友跟学派吧反馈问题说。WordPress上传文件提示HTTP错误,我们将排查处理过程进行记录。分享出来
原因排查
1. 上传一个十几兆mp4的文件上传进度到达百分之百,会媒体提示http错误
2. 刚开始怀疑是PHP、Nginx的上传大小限制了。但是查看PHP、Nginx配置均配置了1000M
- vim /etc/nginx/conf.d/default.conf
- location / {
- root /data/web;
- index index.php index.html index.htm;
- client_max_body_size 000M;
- }
- vim /etc/php.ini
- upload_max_filesize = 000M
- post_max_size = 000M
- max_execution_time = 300
3. 查看Nginx erro日志
- tail /var/log/nginx/error.log
- 2018/02/14 09:32:07 [error] 87522#87522: *1 client intended to send too large body: 35016434 bytes, client: 36.111.88.33, server: localhost, request: "POST /wp-admin/async-upload.php HTTP/1.1", host: "117.66.240.116:81", referrer: "http://117.66.240.116:81/wp-admin/media-new.php"
只有下面这一行是最主要的保存信息。以下错误就是body限制大小的问题
- client intended to send too large body
4. 将限制大小的设定在http中后上串资源就不会在有限制
- vim /etc/nginx/nginx.conf
- http{
- client_max_body_size 1000M;
- keepalive_timeout 300;
- }
语录
如果网友遇到问题,也一定不要着急,可以先百度进行查找下资料。QQ群进行咨询、 可以加我们的QQ群 进行一起教程