413 Wordpress/Kubernetes上的请求实体太大



当我尝试在新安装的Wordpress上上传一个新主题时,我得到了413请求实体太大。

我在StackOverflow上读了很多其他问题,并尝试了以下注释:

  • nginx.ingress.kubernetes.io/secure-backends:"true">
  • nginx.ingress.kubernetes.io/proxy-body-size:"100m">
  • nginx.ingress.kubernetes.io/client-max-body-size:"100m">
  • nginx.org/client-max-body-size:"100米">

工作原理:正在上载小于1MB的文件。

我想这与Bitnami标准的nginx配置有关。如图所示。但我不知道如何将其添加到我当前的配置中。

谢谢你帮我!

**Wordpress Debug Information:**
PHP max input variables 1000
PHP time limit  30
PHP memory limit    512M
Max input time  60
Upload max filesize 40M
PHP post max size   40M
The main WordPress directory    Writable
The wp-content directory    Writable
The uploads directory   Writable
The plugins directory   Writable
The themes directory    Writable

Deployment Yaml
{
"kind": "Deployment",
"apiVersion": "extensions/v1beta1",
"metadata": {
"name": "wordpressdf99e",
"namespace": "default",
"selfLink": "/apis/extensions/v1beta1/namespaces/default/deployments/wordpressdf99e",
"uid": "f39369f1-6c1f-11ea-8b29-063deb7a2778",
"resourceVersion": "18492542",
"generation": 2,
"creationTimestamp": "2020-03-22T09:31:47Z",
"labels": {
"app.kubernetes.io/instance": "wordpressdf99e",
"app.kubernetes.io/managed-by": "Tiller",
"app.kubernetes.io/name": "wordpress",
"helm.sh/chart": "wordpress-9.0.4"
},
"annotations": {
"deployment.kubernetes.io/revision": "2"
}
},
"spec": {
"replicas": 1,
"selector": {
"matchLabels": {
"app.kubernetes.io/instance": "wordpressdf99e",
"app.kubernetes.io/name": "wordpress"
}
},
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"app.kubernetes.io/instance": "wordpressdf99e",
"app.kubernetes.io/managed-by": "Tiller",
"app.kubernetes.io/name": "wordpress",
"helm.sh/chart": "wordpress-9.0.4"
},
"annotations": {
"kubectl.kubernetes.io/restartedAt": "2020-03-22T12:23:46+01:00"
}
},
"spec": {
"volumes": [
{
"name": "wordpress-data",
"persistentVolumeClaim": {
"claimName": "wordpressdf99e"
}
}
],
"containers": [
{
"name": "wordpress",
"image": "docker.io/bitnami/wordpress:5.3.2-debian-10-r48",
"ports": [
{
"name": "http",
"containerPort": 8080,
"protocol": "TCP"
},
{
"name": "https",
"containerPort": 8443,
"protocol": "TCP"
}
],
"env": [
{
"name": "ALLOW_EMPTY_PASSWORD",
"value": "yes"
},
{
"name": "MARIADB_HOST",
"value": "wordpressdf99e-mariadb"
},
{
"name": "MARIADB_PORT_NUMBER",
"value": "3306"
},
{
"name": "WORDPRESS_DATABASE_NAME",
"value": "bitnami_wordpress"
},
{
"name": "WORDPRESS_DATABASE_USER",
"value": "bn_wordpress"
},
{
"name": "WORDPRESS_DATABASE_PASSWORD",
"valueFrom": {
"secretKeyRef": {
"name": "wordpressdf99e-mariadb",
"key": "mariadb-password"
}
}
},
{
"name": "WORDPRESS_USERNAME",
"value": "user"
},
{
"name": "WORDPRESS_PASSWORD",
"valueFrom": {
"secretKeyRef": {
"name": "wordpressdf99e",
"key": "wordpress-password"
}
}
},
{
"name": "WORDPRESS_EMAIL",
"value": "user@example.com"
},
{
"name": "WORDPRESS_FIRST_NAME",
"value": "FirstName"
},
{
"name": "WORDPRESS_LAST_NAME",
"value": "LastName"
},
{
"name": "WORDPRESS_HTACCESS_OVERRIDE_NONE",
"value": "no"
},
{
"name": "WORDPRESS_BLOG_NAME",
"value": "User's Blog!"
},
{
"name": "WORDPRESS_SKIP_INSTALL",
"value": "no"
},
{
"name": "WORDPRESS_TABLE_PREFIX",
"value": "wp_"
},
{
"name": "WORDPRESS_SCHEME",
"value": "http"
}
],
"resources": {
"requests": {
"cpu": "300m",
"memory": "512Mi"
}
},
"volumeMounts": [
{
"name": "wordpress-data",
"mountPath": "/bitnami/wordpress",
"subPath": "wordpress"
}
],
"livenessProbe": {
"httpGet": {
"path": "/wp-login.php",
"port": "http",
"scheme": "HTTP"
},
"initialDelaySeconds": 120,
"timeoutSeconds": 5,
"periodSeconds": 10,
"successThreshold": 1,
"failureThreshold": 6
},
"readinessProbe": {
"httpGet": {
"path": "/wp-login.php",
"port": "http",
"scheme": "HTTP"
},
"initialDelaySeconds": 30,
"timeoutSeconds": 5,
"periodSeconds": 10,
"successThreshold": 1,
"failureThreshold": 6
},
"terminationMessagePath": "/dev/termination-log",
"terminationMessagePolicy": "File",
"imagePullPolicy": "IfNotPresent"
}
],
"restartPolicy": "Always",
"terminationGracePeriodSeconds": 30,
"dnsPolicy": "ClusterFirst",
"securityContext": {
"runAsUser": 1001,
"fsGroup": 1001
},
"schedulerName": "default-scheduler",
"hostAliases": [
{
"ip": "127.0.0.1",
"hostnames": [
"status.localhost"
]
}
]
}
},
"strategy": {
"type": "RollingUpdate",
"rollingUpdate": {
"maxUnavailable": "25%",
"maxSurge": "25%"
}
},
"revisionHistoryLimit": 10,
"progressDeadlineSeconds": 600
},
"status": {
"observedGeneration": 2,
"replicas": 1,
"updatedReplicas": 1,
"readyReplicas": 1,
"availableReplicas": 1,
"conditions": [
{
"type": "Progressing",
"status": "True",
"lastUpdateTime": "2020-03-22T11:34:28Z",
"lastTransitionTime": "2020-03-22T09:31:47Z",
"reason": "NewReplicaSetAvailable",
"message": "ReplicaSet "wordpressdf99e-6bcf574f64" has successfully progressed."
},
{
"type": "Available",
"status": "True",
"lastUpdateTime": "2020-03-22T12:14:55Z",
"lastTransitionTime": "2020-03-22T12:14:55Z",
"reason": "MinimumReplicasAvailable",
"message": "Deployment has minimum availability."
}
]
}
}

如果您使用外部Nginx入口控制器,您将为入口控制器创建一个配置映射,并将代理主体大小设置为所需的大小。

它的默认大小是1m

还有一个bitnami wordpress nginx图像

您可以直接为其设置服务器块,并添加client_max_body_size

https://github.com/bitnami/bitnami-docker-wordpress-nginx/blob/master/test.yaml#L9

感谢您的评论strongjz!

解决这个问题需要的一行代码是:

ingress.bluemix.net/client-max-body-size: "500m"

一旦我将其添加到入口的注释中。问题解决了!

相关内容

  • 没有找到相关文章

最新更新