diff --git a/confs/global/mime.types b/confs/global/mime-types.conf similarity index 100% rename from confs/global/mime.types rename to confs/global/mime-types.conf diff --git a/confs/global/nginx.conf b/confs/global/nginx.conf index eadfeac..20d8548 100644 --- a/confs/global/nginx.conf +++ b/confs/global/nginx.conf @@ -43,7 +43,7 @@ http { tcp_nodelay on; # load mime types and set default one - include /etc/nginx/mime.types; + include /etc/nginx/mime-types.conf; default_type application/octet-stream; # write logs to local syslog diff --git a/confs/site/php.conf b/confs/site/php.conf index 7514b7c..2c283a4 100644 --- a/confs/site/php.conf +++ b/confs/site/php.conf @@ -1,6 +1,7 @@ location ~ \.php$ { {% if REMOTE_PHP != "" +%} - fastcgi_pass {{ REMOTE_PHP }}:9000; + set $backend "{{ REMOTE_PHP }}:9000"; + fastcgi_pass $backend; {% elif LOCAL_PHP != "" +%} fastcgi_pass unix:{{ LOCAL_PHP }}; {% endif %} diff --git a/confs/site/reverse-proxy.conf b/confs/site/reverse-proxy.conf index f448bdf..1678bd1 100644 --- a/confs/site/reverse-proxy.conf +++ b/confs/site/reverse-proxy.conf @@ -7,7 +7,8 @@ {% set headers = all[k.replace("URL", "HEADERS")] if k.replace("URL", "HEADERS") in all else "" %} location {{ url }} {% raw %}{{% endraw +%} etag off; - proxy_pass {{ host }}; + set $backend "{{ host }}"; + proxy_pass $backend; {% if USE_AUTHELIA == "yes" +%} include {{ NGINX_PREFIX }}authelia-auth-request.conf; {% endif %} diff --git a/docs/quickstart_guide.md b/docs/quickstart_guide.md index 20bda09..540b816 100644 --- a/docs/quickstart_guide.md +++ b/docs/quickstart_guide.md @@ -126,7 +126,7 @@ $ docker service create \ --name myservice \ --network services-net \ --constraint node.role==worker \ - -l bunkerized-nginx.SERVER_NAME=www.example.com \ + -l bunkerized-nginx.SERVER_NAME=www.example.com \ -l bunkerized-nginx.USE_REVERSE_PROXY=yes \ -l bunkerized-nginx.REVERSE_PROXY_URL=/ \ -l bunkerized-nginx.REVERSE_PROXY_HOST=http://myservice \ @@ -142,7 +142,7 @@ services: myservice: image: tutum/hello-world networks: - myservice: + services-net: aliases: - myservice deploy: @@ -409,7 +409,9 @@ services: myservice: image: php:fpm networks: - - services-net + services-net: + aliases: + - myservice volumes: - /shared/www/www.example.com:/app deploy: @@ -662,7 +664,7 @@ $ docker service create \ --name myapp1 \ --network services-net \ --constraint node.role==worker \ - -l bunkerized-nginx.SERVER_NAME=app1.example.com \ + -l bunkerized-nginx.SERVER_NAME=app1.example.com \ -l bunkerized-nginx.USE_REVERSE_PROXY=yes \ -l bunkerized-nginx.REVERSE_PROXY_URL=/ \ -l bunkerized-nginx.REVERSE_PROXY_HOST=http://myapp1 \ @@ -672,7 +674,7 @@ $ docker service create \ --constraint node.role==worker \ --network services-net \ --mount type=bind,source=/shared/www/app2.example.com,destination=/app \ - -l bunkerized-nginx.SERVER_NAME=app2.example.com \ + -l bunkerized-nginx.SERVER_NAME=app2.example.com \ -l bunkerized-nginx.REMOTE_PHP=myapp2 \ -l bunkerized-nginx.REMOTE_PHP_PATH=/app \ php:fpm @@ -687,7 +689,9 @@ services: myapp1: image: tutum/hello-world networks: - - services-net + services-net: + aliases: + - myapp1 deploy: placement: constraints: @@ -701,7 +705,9 @@ services: myapp2: image: php:fpm networks: - - services-net + services-net: + aliases: + - myapp2 volumes: - /shared/www/app2.example.com:/app deploy: diff --git a/gen/main.py b/gen/main.py index 0fe156a..26fe003 100755 --- a/gen/main.py +++ b/gen/main.py @@ -50,10 +50,13 @@ if __name__ == "__main__" : configurator.load_variables(variables) config = configurator.get_config() - # TODO : find a proper way to remove old sites - env_list = glob.glob(args.output + "/**/*.env", recursive=True) - for env in env_list : - os.remove(env) + # Remove old files + files = glob.glob(args.output + "/*") + for file in files : + if file.endswith(".conf") and os.path.isfile(file) : + os.remove(file) + elif os.path.isdir(file) : + shutil.rmtree(file, ignore_errors=False) # Generate the files from templates and config templator = Templator(config, args.templates, args.output, args.target)