Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 438
Dr. X Avatar asked Nov 16 '17 10:11

Dr. X


People also ask

What is Docker nginx proxy?

nginx-proxy sets up a container running nginx and docker-gen. docker-gen generates reverse proxy configs for nginx and reloads nginx when containers are started and stopped. See Automated Nginx Reverse Proxy for Docker for why you might want to use this.

Which is a prerequisite for using a Docker reverse proxy?

In order to get the reverse proxy to actually work, we need to reload the nginx service inside the container. From the host, run docker exec <container-name> nginx -t . This will run a syntax checker against your configuration files. This should output that the syntax is ok.


1 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
like image 186
Dr. X Avatar answered Oct 01 '22 12:10

Dr. X