docksal / service-nginx

Nginx service images for Docksal
https://docksal.io
MIT License
0 stars 3 forks source link

Feature request - custom configuration with upstream #21

Open svandragt opened 2 years ago

svandragt commented 2 years ago

So I'm hacking on a WordPress multisite application, for which none of the presets work properly. I'm using a vhost-override and encountering the following issue:

  1. Nginx bails on duplicate configuration entries, so I cannot override the php location in the wordpress preset.
  2. When I set NGINX_VHOST_PRESET="" as some other NGINX images encourage, the shell script still tries to include a present with no name. But, this doesn't really work for my scenario anyway, because the upstream is limited to drupal, php, or wordpress presets.
  3. if I add an override to the html preset, there is no php-fpm upstream to connect to.
  4. it's invalid nginx configuration to include an upstream in user-vhosts.conf in combination with the html preset.

I think the current workaround is to use a regular html preset, and then fin exec --in=web a script file to replace some of the provided configuration, then trick nginx to reload

So, I would like to request a way to have a bare php application that only includes the upstream. Perhaps the user can provide a custom preset or the repo can provide php-bare that just sets index?

Appreciate your thoughts, happy to contribute.

svandragt commented 2 years ago

Currently I have to add this to my init script:

fin exec --in=web cp -f .docksal/etc/nginx/includes/preset.conf /etc/nginx/includes/preset.conf
fin exec --in=web gomplate --file /etc/nginx/includes/upstream.php-fpm.conf.tmpl --out /etc/nginx/includes/upstream.conf
fin exec --in=web nginx -s reload