文章作者:[灵风子](https://www.wordpressmatrix.com/author/tonvin)
WordPress网站后台,撰写新文章,添加媒体,上传文件时出现“HTTP错误”;
我使用的是Centos7.4 操作系统,WEB服务器是Nginx 1.12.2
查看Nginx错误日志
Shell
| col 1 | col 2 |
|---|---|
| 1 | tail -f /var/log/nginx/error.log |
发现错误信息 client intended to send too large body
此种错误在web前端通常显示为413 Request Entity Too Large
此时编辑Nginx配置文件
| col 1 | col 2 |
|---|---|
| 1 | vim /etc/nginx/nginx.conf |
在http{………….}配置中添加下面一行,设定上传文件大小不超过5M
YAML
| col 1 | col 2 |
|---|---|
| 1 | client_max_body_size 5M; |
然后重载nginx配置
| col 1 | col 2 |
|---|---|
| 1 | systemctl restart Nginx |
再次执行上传图片操作,未出现错误。
from https://www.wordpressmatrix.com/faq/221/fix-wordpess-upload-image-error/
No comments:
Post a Comment