通过k8s配置wordpress后,上传大文件会出现“413 Request Entity Too Large”的错误。可通过下面方式修正
如果有外部nginx做转发,需要设置 client_body_max_size
1
2
3http {
client_max_body_size 0; # 设置为0代表不做限制
}WordPress的Ingress也需要配置 client_max_body_size
1
2
3
4
5
6apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: wp-ingress
annotations:
nginx.ingress.kubernetes.io/proxy-body-size: 512m下载
Increase Maximum Upload File Size
插件/或配置uploads.ini
配置uploads.ini方式
① 创建uploads.ini
1 | file_uploads = On |
② 添加configMap配置
1 | kubectl create configmap wp-uploads-ini --from-file uploads.ini |
③ 映射到文件 /usr/local/etc/php/conf.d/uploads.ini
1 | containers: |