How can I change the docker jwilder/nginx-proxy upload limits?

Viewed 4377

In my architecture I use the /jwilder/nginx-proxy as a proxy server in my docker and then I installed 3 WordPress websites with MySQL and WordPress.

They are working well but /jwilder/nginx-proxy has a default configuration upload limit to 2MB but my WordPress template is about 20MB.

When I am trying to upload this template

413 Request Entity Too Large
nginx/1.13.6

In addition, I used below code to install /jwilder/nginx-proxy

docker run -d -p 80:80 --name nginx-proxy  -v /var/run/docker.sock:/tmp/docker.sock jwilder/nginx-proxy

How can I configure the upload limits?

Regards

2 Answers

After searching, I create a file outside the container called client_max_body_size.conf with the contents client_max_body_size 25m; (or whatever) and bind mount it into your nginx-proxy container:

docker run -d --name nginx-proxy -v /var/run/docker.sock:/tmp/docker.sock \
    -v $ <path>/client_max_body_size.conf:/etc/nginx/conf.d/client_max_body_size.conf:ro \
    -p 80:80 jwilder/nginx-proxy

In addition, you need to add the following code at the bottom of your .htaccess file.

php_value upload_max_filesize 128M
php_value post_max_size 128M
php_value max_execution_time 300
php_value max_input_time 300

Don’t forget to save your changes and upload the file back to your website.

Related