skip to Main Content

When trying to upload a new theme on my fresh WordPress install, I get the 413 Request Entity Too Large.

I’ve read a lot of other questions on StackOverflow and tried these annotations:

  • 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: “100m”

What works:
Uploading files smaller than 1MB.

I guess it has to do with the Bitnami standard nginx configuration. As seen here . But I have no clue on how to add this to my current configuration.

Thanks for helping me out!

**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": "[email protected]"
              },
              {
                "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."
      }
    ]
  }
}

2

Answers


  1. Chosen as BEST ANSWER

    Thanks for your comment strongjz!

    The one line of code that was needed to solve this problem was:

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

    Once I've added this to the annotations of my ingress. The issue was solved!


  2. If you were using an external Nginx Ingress Controller you would create a configmap for your ingress controllers and set the proxy-body-size to the size needed.

    The default size for it is 1m

    There is also a bitnami wordpress nginx image

    Where you can set the Server block for it directly and add client_max_body_size

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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search