I need to increase the client_max_body_size
setting for a single app I have installed on a Dokku Paas. I could edit the nginx configuration globally, but that would be brittle, and I would like this setting to live with the app config where possible.
I have seen some plugins that help rewrite the nginx.conf file (eg. https://github.com/mikexstudios/dokku-nginx-alt), but that seems like overkill when I only want to change a single setting.
I have also noticed the nginx-configure
plugin hook (https://github.com/progrium/dokku/pull/189), but I could not find clear instructions on how to use this from an app (where would I put the hook script, for example?).
What is the cleanest, most maintainable and most portable method of setting a single nginx configuration parameter on a per app basis?
This question is a bit old, but I ran into it while searching for a solution to the same question.
By default, dokku sites are installed in /home/dokku/{site-name}
.
There is one main nginx
file per app in this folder, nginx.conf
. This file will be replaced every time you deploy so you don't want to change this.
However, you will see that this main nginx.conf
file has the following line it in -
include /home/dokku/{site-name}/nginx.conf.d/*.conf;
Which will include any .conf files in the nginx.conf.d
folder.
So you can add a file called upload.conf
(for example) to the nginx.conf.d
folder, containing just client_max_body_size 50M;
, and you'll achieve what you want to do.
After you create the directory and config file, ensure you chown
them to the dokku
user.
See https://github.com/dokku/dokku/blob/master/docs/configuration/nginx.md for further details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With