How do I set nginx config options for each application in Dokku?

I need to increase the parameter client_max_body_size

for one application that I have installed on Dokku Paas. I could change the nginx config globally, but that would be fragile and I would like this setting to work with the application config where possible.

I've seen some plugins that help rewrite the nginx.conf file (e.g. https://github.com/mikexstudios/dokku-nginx-alt ), but that seems overkill when I only want to change one setting.

I also noticed nginx-configure

the hook plugin ( https://github.com/progrium/dokku/pull/189 ), but I couldn't find clear instructions on how to use this from the app (where would I put the hook script, for example?) ...

What's the cleanest, most supported, and most portable way to set one nginx config option per application?

+4


source to share


1 answer


This question is a bit old, but I ran into it while looking for a solution to the same question.

By default, dokku sites are installed in /home/dokku/{site-name}

.

In this folder, there is one main file for each application nginx

, nginx.conf

. This file will be replaced every time you deploy, so you don't want to change it.

However, you will see that this main file nginx.conf

has the following line:

  include /home/dokku/{site-name}/nginx.conf.d/*.conf;

      



Which will include any .conf files in the folder nginx.conf.d

.

Thus, you can add a file named upload.conf

(for example) to the folder nginx.conf.d

containing only client_max_body_size 50M;

and you will achieve what you want.

After creating the directory and config file, make sure you check chown

them in dokku

.

See https://github.com/dokku/dokku/blob/master/docs/configuration/nginx.md for more information.

+6


source







All Articles