简述
在公司内部搭建内部视频学习网站,经过对比选择了wordpress进行站点搭建。但是在上传视频遭遇到了各种问题,特将此处理过程进行记录。
原因排查
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 1000M;
}
vim /etc/php.ini
upload_max_filesize = 1000M
post_max_size = 1000M
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;
}