0

I want to configure client_max_body_size of a dockerized nginx proxy directly inside the docker-compose.yml.

I find this ressources : https://github.com/nginx-proxy/nginx-proxy/issues/690,but it seems none of the solution are adapted.

Here is my docker-compose.yml (version: '3.7') :

web-proxy:
    container_name: test-proxy
    image: nginxproxy/nginx-proxy
    depends_on: 
      - web
    volumes:
      - /nginx/conf:/etc/nginx/conf.d
      - /nginx/vhost:/etc/nginx/vhost.d
      - /nginx/html:/usr/share/nginx/html
      - /nginx/dhparam:/etc/nginx/dhparam
      - /nginx/certs:/etc/nginx/certs:ro
      - /var/run/docker.sock:/tmp/docker.sock:ro
    ports:
      - 80:80
      - 443:443

Alternative way should be to add an aditional configuration file in the volume already mounted, but I would prefer configuring it entirely inside the docker-compose file.

bloub
  • 510
  • 1
  • 4
  • 21

1 Answers1

1

this is from the image docs Custom Nginx Configuration:

Proxy-wide

To add settings on a proxy-wide basis, add your configuration file under /etc/nginx/conf.d using a name ending in .conf.

This can be done in a derived image by creating the file in a RUN command or by COPYing the file into conf.d:

FROM nginxproxy/nginx-proxy
RUN { \
      echo 'server_tokens off;'; \
      echo 'client_max_body_size 100m;'; \
    } > /etc/nginx/conf.d/my_proxy.conf
Noam Yizraeli
  • 4,446
  • 18
  • 35