[GH-ISSUE #93] Set client_max_body_size and other Nginx configrations #83

Closed
opened 2026-02-26 05:34:14 +03:00 by kerem · 14 comments
Owner

Originally created by @relink2013 on GitHub (Mar 4, 2019).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/93

I need to add a client_max_body_size 10000m; to one of my proxy hosts, but there seems to be no obvious way to do it. I tried adding it directly to the .conf file, but it did not work.

Originally created by @relink2013 on GitHub (Mar 4, 2019). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/93 I need to add a `client_max_body_size 10000m;` to one of my proxy hosts, but there seems to be no obvious way to do it. I tried adding it directly to the .conf file, but it did not work.
kerem 2026-02-26 05:34:14 +03:00
Author
Owner

@jc21 commented on GitHub (Mar 5, 2019):

At the moment you can't. But I'll convert this to a future feature.

<!-- gh-comment-id:469502788 --> @jc21 commented on GitHub (Mar 5, 2019): At the moment you can't. But I'll convert this to a future feature.
Author
Owner

@ghzgod commented on GitHub (Mar 7, 2019):

At the moment you can't. But I'll convert this to a future feature.

So what is the work around for this? My nextcloud photo uploads are so slow.

<!-- gh-comment-id:470456242 --> @ghzgod commented on GitHub (Mar 7, 2019): > > > At the moment you can't. But I'll convert this to a future feature. So what is the work around for this? My nextcloud photo uploads are so slow.
Author
Owner

@UniverseM5 commented on GitHub (Mar 23, 2019):

I also have a lot of customisations in nginx.conf file (e.g. add_header, ssl_, gzip_, proxy_, auth_basic_ etc.). Not being able set it manually in the Manager is stopping me from moving to here. Otherwise, idea/app is brilliant. Thanks.

<!-- gh-comment-id:475866196 --> @UniverseM5 commented on GitHub (Mar 23, 2019): I also have a lot of customisations in nginx.conf file (e.g. add_header, ssl_, gzip_, proxy_, auth_basic_ etc.). Not being able set it manually in the Manager is stopping me from moving to here. Otherwise, idea/app is brilliant. Thanks.
Author
Owner

@niklasdahlheimer commented on GitHub (Mar 25, 2019):

Hey
Great app so far!
I also need to edit the nginx.conf and add
client_max_body_size 0
to prevent a timeout while uploading a lot of data at once
Seems like the nginx.conf is not part of the mountable /conf folder. Is there any way to edit the nginx.conf via SSH opening a bash in the container?

<!-- gh-comment-id:476194645 --> @niklasdahlheimer commented on GitHub (Mar 25, 2019): Hey Great app so far! I also need to edit the nginx.conf and add `client_max_body_size 0` to prevent a timeout while uploading a lot of data at once Seems like the nginx.conf is not part of the mountable /conf folder. Is there any way to edit the nginx.conf via SSH opening a bash in the container?
Author
Owner

@jc21 commented on GitHub (Mar 27, 2019):

For the time being here's a hack:

Connect to your already running NPM container with

docker exec -ti name_of_container bash

and then

cp /etc/nginx/nginx.conf /data/nginx/

So what you just did was enter the running container filesystem and copy the built-in nginx.conf file to your mounted data folder.

Now you have to bring down your docker containers and forcibly mount the nginx.conf file over the top of the built in one. You'll have to edit your docker-compose.yml file or however you run your container to mount it:

  app:
    image: jc21/nginx-proxy-manager:latest
    restart: always
    ports:
      - 80:80
      - 81:81
      - 443:443
    volumes:
      - ./config.json:/app/config/production.json
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt
      - ./data/nginx.conf:/etc/nginx/nginx.conf
    depends_on:
      - db

Make changes to your version of the config and restart the container to take effect.

<!-- gh-comment-id:476969724 --> @jc21 commented on GitHub (Mar 27, 2019): For the time being here's a hack: Connect to your already running NPM container with ```bash docker exec -ti name_of_container bash ``` and then ```bash cp /etc/nginx/nginx.conf /data/nginx/ ``` So what you just did was enter the running container filesystem and copy the built-in `nginx.conf` file to your mounted data folder. Now you have to bring down your docker containers and forcibly mount the `nginx.conf` file over the top of the built in one. You'll have to edit your `docker-compose.yml` file or however you run your container to mount it: ```yml app: image: jc21/nginx-proxy-manager:latest restart: always ports: - 80:80 - 81:81 - 443:443 volumes: - ./config.json:/app/config/production.json - ./data:/data - ./letsencrypt:/etc/letsencrypt - ./data/nginx.conf:/etc/nginx/nginx.conf depends_on: - db ``` Make changes to your version of the config and restart the container to take effect.
Author
Owner

@allebb commented on GitHub (Apr 19, 2019):

@relink2013 @niklasdahlheimer I added client_max_body_size 0; to the "Advanced" tab and seems to be working just fine for my Nextcloud and Minio services that sit behind my proxy.

Capture

<!-- gh-comment-id:485040136 --> @allebb commented on GitHub (Apr 19, 2019): @relink2013 @niklasdahlheimer I added ``client_max_body_size 0;`` to the "Advanced" tab and seems to be working just fine for my Nextcloud and Minio services that sit behind my proxy. ![Capture](https://user-images.githubusercontent.com/767628/56448393-a45ca780-6306-11e9-8a7d-a3fcaad9023e.JPG)
Author
Owner

@zeighy commented on GitHub (Apr 20, 2019):

@relink2013 @niklasdahlheimer I added client_max_body_size 0; to the "Advanced" tab and seems to be working just fine for my Nextcloud and Minio services that sit behind my proxy.

Capture

literally looking this up because I'm having issues where big downloads/uploads getting cut off "mysteriously" on my nextcloud (in unraid) found your settings and copied them over (with some adjustments) and the issues magically went away. :P thanks!

Looks like the advanced tab comes in real handy

<!-- gh-comment-id:485150090 --> @zeighy commented on GitHub (Apr 20, 2019): > @relink2013 @niklasdahlheimer I added `client_max_body_size 0;` to the "Advanced" tab and seems to be working just fine for my Nextcloud and Minio services that sit behind my proxy. > > ![Capture](https://user-images.githubusercontent.com/767628/56448393-a45ca780-6306-11e9-8a7d-a3fcaad9023e.JPG) literally looking this up because I'm having issues where big downloads/uploads getting cut off "mysteriously" on my nextcloud (in unraid) found your settings and copied them over (with some adjustments) and the issues magically went away. :P thanks! Looks like the advanced tab comes in real handy
Author
Owner

@allebb commented on GitHub (Apr 24, 2019):

No worries @zeighy - I'm glad I was able to be of help 👍

<!-- gh-comment-id:486225029 --> @allebb commented on GitHub (Apr 24, 2019): No worries @zeighy - I'm glad I was able to be of help 👍
Author
Owner

@lordraiden commented on GitHub (Apr 24, 2019):

@jc21 Can I add all this to the advanced tab, or it will break things?
This is suppose to be a hardened configuration, ideally this could be configure at some point in the future from the interface with drop down menus, etc and links to the official nginx doc.

This is a good source of a hardened configuration https://gist.github.com/plentz/6737338 although the one below is a little bit more restrictive (secure), I think.
Maye you could start by adding this options to the interface

`

Basic Proxy Config

proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Ssl on;
proxy_redirect http:// $scheme://;
proxy_http_version 1.1;
proxy_set_header Connection "";
#proxy_cookie_path / "/; HTTPOnly; Secure"; # enable at your own risk, may break certain apps
proxy_cache_bypass $cookie_session;
proxy_no_cache $cookie_session;
proxy_buffers 32 4k;

Custom Proxy config hardening

proxy_hide_header X-Powered-By;
add_header Content-Security-Policy "upgrade-insecure-requests";
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Cache-Control "no-transform" always;
add_header Referrer-Policy no-referrer always;
add_header X-Robots-Tag none;
#add_header X-UA-Compatible "IE=Edge" always;`

protocols

ssl_protocols TLSv1.2;
ssl_prefer_server_ciphers on;

Custom settings hardening

ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';

HSTS, remove # from the line below to enable HSTS

add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;

OCSP Stapling

ssl_stapling on;
ssl_stapling_verify on;

<!-- gh-comment-id:486288225 --> @lordraiden commented on GitHub (Apr 24, 2019): @jc21 Can I add all this to the advanced tab, or it will break things? This is suppose to be a hardened configuration, ideally this could be configure at some point in the future from the interface with drop down menus, etc and links to the official nginx doc. This is a good source of a hardened configuration https://gist.github.com/plentz/6737338 although the one below is a little bit more restrictive (secure), I think. Maye you could start by adding this options to the interface ` # Basic Proxy Config proxy_set_header Host $host:$server_port; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto https; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Ssl on; proxy_redirect http:// $scheme://; proxy_http_version 1.1; proxy_set_header Connection ""; #proxy_cookie_path / "/; HTTPOnly; Secure"; # enable at your own risk, may break certain apps proxy_cache_bypass $cookie_session; proxy_no_cache $cookie_session; proxy_buffers 32 4k; # Custom Proxy config hardening proxy_hide_header X-Powered-By; add_header Content-Security-Policy "upgrade-insecure-requests"; add_header X-Frame-Options "SAMEORIGIN"; add_header X-XSS-Protection "1; mode=block" always; add_header X-Content-Type-Options "nosniff" always; add_header Cache-Control "no-transform" always; add_header Referrer-Policy no-referrer always; add_header X-Robots-Tag none; #add_header X-UA-Compatible "IE=Edge" always;` # protocols ssl_protocols TLSv1.2; ssl_prefer_server_ciphers on; # Custom settings hardening ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH'; # HSTS, remove # from the line below to enable HSTS add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always; # OCSP Stapling ssl_stapling on; ssl_stapling_verify on;
Author
Owner

@millercentral commented on GitHub (Dec 2, 2022):

This is marked completed, but when I add client_max_body_size 10000M; to my custom config in NPM is brings down the Proxy Host. Is there any details on how to add this config via the UI (as opposed to the workaround to override the .conf file)?

<!-- gh-comment-id:1335507306 --> @millercentral commented on GitHub (Dec 2, 2022): This is marked completed, but when I add `client_max_body_size 10000M;` to my custom config in NPM is brings down the Proxy Host. Is there any details on how to add this config via the UI (as opposed to the workaround to override the .conf file)?
Author
Owner

@pppfz commented on GitHub (Dec 25, 2024):

@relink2013 @niklasdahlheimer I added client_max_body_size 0; to the "Advanced" tab and seems to be working just fine for my Nextcloud and Minio services that sit behind my proxy.

Capture

Hey, hello, I'm very sorry to bother you. I want to ask you a question. Why can't it work successfully after I followed the method?

1. First, my docker-compose.yml is as follows:

services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    ports:
      - '80:80'
      - '81:81'
      - '443:443'
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt

2. I added two Proxy Hosts

I successfully found their configuration at: ./npm/data/nginx/proxy_host/1.conf or 2.conf
Their configuration content is:

The first one (conf after removing sensitive data and adding advanced configuration in the panel)

image

map $scheme $hsts_header {
    https   "max-age=63072000; preload";
}

server {
  set $forward_scheme http;
  set $server         "1.1.1.1";
  set $port           9001;

  listen 80;
listen [::]:80;

listen 443 ssl http2;
listen [::]:443 ssl http2;

  server_name m.example.com;

  # Let's Encrypt SSL
  include conf.d/include/letsencrypt-acme-challenge.conf;
  include conf.d/include/ssl-ciphers.conf;
  ssl_certificate /etc/letsencrypt/live/npm-1/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/npm-1/privkey.pem;

# Asset Caching
  include conf.d/include/assets.conf;

  # Block Exploits
  include conf.d/include/block-exploits.conf;

    # Force SSL
    include conf.d/include/force-ssl.conf;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_http_version 1.1;


  access_log /data/logs/proxy-host-1_access.log proxy;
  error_log /data/logs/proxy-host-1_error.log warn;

client_max_body_size 0;
proxy_connect_timeout 300s;
proxy_send_timeout 300s;
proxy_read_timeout 300s;


  location / {

    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $http_connection;
    proxy_http_version 1.1;
    

    # Proxy!
    include conf.d/include/proxy.conf;
  }


  # Custom
  include /data/nginx/custom/server_proxy[.]conf;
}

The second one (conf after removing sensitive data and adding advanced configuration in the panel)

map $scheme $hsts_header {
    https   "max-age=63072000; preload";
}

server {
  set $forward_scheme http;
  set $server         "1.1.1.1";
  set $port           9000;

  listen 80;
listen [::]:80;

listen 443 ssl;
listen [::]:443 ssl;

  server_name api.example.com;

  # Let's Encrypt SSL
  include conf.d/include/letsencrypt-acme-challenge.conf;
  include conf.d/include/ssl-ciphers.conf;
  ssl_certificate /etc/letsencrypt/live/npm-2/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/npm-2/privkey.pem;

# Asset Caching
  include conf.d/include/assets.conf;

  # Block Exploits
  include conf.d/include/block-exploits.conf;

proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_http_version 1.1;

  access_log /data/logs/proxy-host-2_access.log proxy;
  error_log /data/logs/proxy-host-2_error.log warn;

client_max_body_size 0;
proxy_connect_timeout 300s;
proxy_send_timeout 300s;
proxy_read_timeout 300s;

  location / {
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $http_connection;
    proxy_http_version 1.1;
   

    # Proxy!
    include conf.d/include/proxy.conf;
  }
  # Custom
  include /data/nginx/custom/server_proxy[.]conf;
}

Give other information

  • I mainly use npm reverse proxy minio service
  • Enable cloudflare's cdn (but I have turned it off and tested it, and it still failed)
  • Already restarted many times
  • English is not my native language, please forgive the inaccurate translation.
<!-- gh-comment-id:2561828345 --> @pppfz commented on GitHub (Dec 25, 2024): > @relink2013 @niklasdahlheimer I added `client_max_body_size 0;` to the "Advanced" tab and seems to be working just fine for my Nextcloud and Minio services that sit behind my proxy. > > ![Capture](https://user-images.githubusercontent.com/767628/56448393-a45ca780-6306-11e9-8a7d-a3fcaad9023e.JPG) Hey, hello, I'm very sorry to bother you. I want to ask you a question. Why can't it work successfully after I followed the method? ## 1. First, my docker-compose.yml is as follows: ```yml services: app: image: 'jc21/nginx-proxy-manager:latest' restart: unless-stopped ports: - '80:80' - '81:81' - '443:443' volumes: - ./data:/data - ./letsencrypt:/etc/letsencrypt ``` ## 2. I added two Proxy Hosts I successfully found their configuration at: ./npm/data/nginx/proxy_host/1.conf or 2.conf Their configuration content is: ### The first one (conf after removing sensitive data and adding advanced configuration in the panel) ![image](https://github.com/user-attachments/assets/281d8c49-baa6-4f31-8c97-8c06529d6642) ``` map $scheme $hsts_header { https "max-age=63072000; preload"; } server { set $forward_scheme http; set $server "1.1.1.1"; set $port 9001; listen 80; listen [::]:80; listen 443 ssl http2; listen [::]:443 ssl http2; server_name m.example.com; # Let's Encrypt SSL include conf.d/include/letsencrypt-acme-challenge.conf; include conf.d/include/ssl-ciphers.conf; ssl_certificate /etc/letsencrypt/live/npm-1/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/npm-1/privkey.pem; # Asset Caching include conf.d/include/assets.conf; # Block Exploits include conf.d/include/block-exploits.conf; # Force SSL include conf.d/include/force-ssl.conf; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $http_connection; proxy_http_version 1.1; access_log /data/logs/proxy-host-1_access.log proxy; error_log /data/logs/proxy-host-1_error.log warn; client_max_body_size 0; proxy_connect_timeout 300s; proxy_send_timeout 300s; proxy_read_timeout 300s; location / { proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $http_connection; proxy_http_version 1.1; # Proxy! include conf.d/include/proxy.conf; } # Custom include /data/nginx/custom/server_proxy[.]conf; } ``` ### The second one (conf after removing sensitive data and adding advanced configuration in the panel) ``` map $scheme $hsts_header { https "max-age=63072000; preload"; } server { set $forward_scheme http; set $server "1.1.1.1"; set $port 9000; listen 80; listen [::]:80; listen 443 ssl; listen [::]:443 ssl; server_name api.example.com; # Let's Encrypt SSL include conf.d/include/letsencrypt-acme-challenge.conf; include conf.d/include/ssl-ciphers.conf; ssl_certificate /etc/letsencrypt/live/npm-2/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/npm-2/privkey.pem; # Asset Caching include conf.d/include/assets.conf; # Block Exploits include conf.d/include/block-exploits.conf; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $http_connection; proxy_http_version 1.1; access_log /data/logs/proxy-host-2_access.log proxy; error_log /data/logs/proxy-host-2_error.log warn; client_max_body_size 0; proxy_connect_timeout 300s; proxy_send_timeout 300s; proxy_read_timeout 300s; location / { proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $http_connection; proxy_http_version 1.1; # Proxy! include conf.d/include/proxy.conf; } # Custom include /data/nginx/custom/server_proxy[.]conf; } ``` ## Give other information - I mainly use npm reverse proxy minio service - Enable cloudflare's cdn (but I have turned it off and tested it, and it still failed) - Already restarted many times - English is not my native language, please forgive the inaccurate translation.
Author
Owner

@ratulSharker commented on GitHub (Feb 9, 2025):

@relink2013 @niklasdahlheimer I added client_max_body_size 0; to the "Advanced" tab and seems to be working just fine for my Nextcloud and Minio services that sit behind my proxy.

Capture

Adding only the following works for me:

proxy_buffering off;
proxy_redirect off;
client_max_body_size 0;
<!-- gh-comment-id:2646171546 --> @ratulSharker commented on GitHub (Feb 9, 2025): > [@relink2013](https://github.com/relink2013) [@niklasdahlheimer](https://github.com/niklasdahlheimer) I added `client_max_body_size 0;` to the "Advanced" tab and seems to be working just fine for my Nextcloud and Minio services that sit behind my proxy. > > ![Capture](https://user-images.githubusercontent.com/767628/56448393-a45ca780-6306-11e9-8a7d-a3fcaad9023e.JPG) Adding only the following works for me: ```conf proxy_buffering off; proxy_redirect off; client_max_body_size 0; ```
Author
Owner

@VictorRomano commented on GitHub (Jul 21, 2025):

Adding only the following works for me:

proxy_buffering off;
proxy_redirect off;
client_max_body_size 0;

This worked for me, thanks!

<!-- gh-comment-id:3099681524 --> @VictorRomano commented on GitHub (Jul 21, 2025): > Adding only the following works for me: > > ``` > proxy_buffering off; > proxy_redirect off; > client_max_body_size 0; > ``` This worked for me, thanks!
Author
Owner

@azaloum90 commented on GitHub (Feb 15, 2026):

@relink2013 @niklasdahlheimer I added client_max_body_size 0; to the "Advanced" tab and seems to be working just fine for my Nextcloud and Minio services that sit behind my proxy.

Capture

Thank you for this, saved me on my next cloud instance as it did for some other posters!

<!-- gh-comment-id:3904973002 --> @azaloum90 commented on GitHub (Feb 15, 2026): > [@relink2013](https://github.com/relink2013) [@niklasdahlheimer](https://github.com/niklasdahlheimer) I added `client_max_body_size 0;` to the "Advanced" tab and seems to be working just fine for my Nextcloud and Minio services that sit behind my proxy. > > ![Capture](https://user-images.githubusercontent.com/767628/56448393-a45ca780-6306-11e9-8a7d-a3fcaad9023e.JPG) Thank you for this, saved me on my next cloud instance as it did for some other posters!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nginx-proxy-manager-NginxProxyManager#83
No description provided.