assegnazione automatica tramite configurazione docker
Find a file
2020-04-26 21:56:16 +10:00
.github Add issue template/q&a links 2018-03-23 21:07:43 -06:00
test Fix the test 2019-08-07 17:33:02 +01:00
.dockerignore Add Makefile 2015-10-14 10:29:22 -06:00
.gitignore SWARM multi node multi container compatible 2020-04-26 17:24:22 +10:00
.travis.yml Remove old docker.list to avoid getting unstable Docker version 2018-04-22 16:43:00 -04:00
dhparam.pem.default Implemented background dhparam generation 2017-01-11 22:43:09 -05:00
docker-compose-separate-containers.yml Remove proxy-tier network in favor of the default. 2016-07-29 17:23:10 -04:00
docker-compose.yml Upgrade to nginx 1.11.10 2017-02-21 14:03:54 +01:00
docker-entrypoint.sh Merge pull request #913 from panteparak/DH-Param-Generator-Option 2019-03-05 12:46:49 -07:00
Dockerfile nginx needs a config to start 2020-04-26 17:39:19 +10:00
Dockerfile.alpine Upgrade to 1.17.8 2020-02-28 16:36:36 +01:00
generate-dhparam.sh Merge pull request #913 from panteparak/DH-Param-Generator-Option 2019-03-05 12:46:49 -07:00
LICENSE Adding license for usage 2015-01-08 11:29:04 -08:00
Makefile TESTS: replace old test suite with the new one 2017-02-17 00:29:30 +01:00
mergeswarm.py Make sure that I don't duplicate servers or upstream, if their arguments come in different order they are considered different 2020-04-26 18:32:29 +10:00
network_internal.conf Implemented NETWORK_ACCESS (squash commit) 2017-10-18 13:29:12 -04:00
nginx.tmpl SWARM multi node multi container compatible 2020-04-26 17:24:22 +10:00
Procfile Turns out I had to create a folder :/ remove the loop script and bugfix 2020-04-26 18:04:58 +10:00
README.md doc related to this project 2020-04-26 21:56:16 +10:00
swarm.stack.yml Turns out I had to create a folder :/ remove the loop script and bugfix 2020-04-26 18:04:58 +10:00

nginx-proxy

This repository is a fork of the very well known jwilder/nginx-proxy

I customised it to my needs. Which are:

  • Provide an override for location /
  • While using fastcgi, nginx serves static files directly instead of passing them along
  • Multi node, Multi container swarm config

How did I solve the swarm situation

  • Every node generate their config as usual, except they do it in a different folder (/etc/nginx/node.conf.d/)
  • the nginx.tmpl is using service_name instead of IP
  • The proxy is deployed globally (one instance per node)
  • Everytime a new file is added to the node.conf.d or everytime any file in this directory is updated, (entr)[http://eradman.com/entrproject/] will run a python script
  • That python script combines all configs into one that is /etc/nginx/conf.d/default.conf using (crossplane)[https://github.com/nginxinc/crossplane]

For this to work, all you need is a way to share data between node. It could be a volume driver or anything. I'm using azure, so I have a shared directory on all nodes (which also contains my static files) so I bind /etc/nginx/node.conf.d/ in the shared directory, all nodes add their files, all proxy will regenerate their config including all other nodes. When a new node joins, entr will trigger in each node and the new configuration is generated. If you rebalance your swarm, docker-gen will trigger, that node's config will be updated which in turns triggers entr and so on.

Override root location

You can set LOCATION_PATH=xxx (eg: "~ .php$") and use the vhost.d/default or vhost.d/{VIRTUAL_HOST} to add:

location / {
    try_files $uri /index.php?$query_string;
    limit_rate_after 1000k;
    limit_rate 50k;
}

location {LOCATION_PATH} {
  ...
}

Bind static files

You can bind your files in "/etc/nginx/static_files/{VIRTUAL_HOST}" and nginx will set the root of the server block to that folder as follows:

server {
  ...

  root /etc/nginx/static_files/my.domain.com;

  '''
}

In combination with LOCATION_PATH override you can skip sending queries to the container and serve files directly.

Be aware that if using FastCGI you will also have to explicitly set your VIRTUAL_ROOT.