From 220b438f64c67a440a85387b55dff37eaa7c3b9c Mon Sep 17 00:00:00 2001 From: Nicolai Winther Hjorth Date: Thu, 29 Nov 2018 21:23:45 +0100 Subject: [PATCH 1/4] Added support for configuring listener port on docker host and instructions for running on Synology DSM Nas --- .env.sample | 10 ++++++++++ Docs/HOWTO-Synlogy.md | 27 +++++++++++++++++++++++++++ docker-compose-multiple-networks.yml | 6 +++--- docker-compose.yml | 4 ++-- 4 files changed, 42 insertions(+), 5 deletions(-) create mode 100755 Docs/HOWTO-Synlogy.md diff --git a/.env.sample b/.env.sample index aa68c74..b0e8873 100644 --- a/.env.sample +++ b/.env.sample @@ -18,6 +18,16 @@ LETS_ENCRYPT=nginx-letsencrypt # IP=0.0.0.0 +# +# Set the local exposed ports for http and https - this will allow you to run with a legacy web +# server already installed for local use +# +# NOTE: For this to function your internet router must forward the official ports to the mapped ports - +# in this example external port 80 to docker host 81 and external port 443 to docker host 444 +# +#DOCKER_HTTP=81 +#DOCKER_HTTPS=444 + # # Default Network # diff --git a/Docs/HOWTO-Synlogy.md b/Docs/HOWTO-Synlogy.md new file mode 100755 index 0000000..43eab4a --- /dev/null +++ b/Docs/HOWTO-Synlogy.md @@ -0,0 +1,27 @@ +## Port mapping +Synology default installs a web server on port 80 blocking certificate generation. + +To circumvent this - if you do not need extenral access to the default web server (and you should not expose it anyway) configure your .env to use alternative ports and your router to forward the external official port to the alternative internal ports: + +# +# Set the local exposed ports for http and https - this will allow you to run with a legacy web +# server already installed for local use +# +# NOTE: For this to function your internet router must forward the official ports to the mapped ports - +# in this example external port 80 to docker host 81 and external port 443 to docker host 444 +# +DOCKER_HTTP=81 +DOCKER_HTTPS=444 + +## File permissions +To setup the needed configuration directoties and proper permissions run the below commands (assuming default ./data is where you have your catalog for persistent files) + +mkdir -p data/certs +mkdir data/htpasswd +mkdir data/conf.d +mkdir data/vhost.d +mkdir data/html +chgrp -R 101 data +chmod -R g+rwx data + +Contributed by https://github.com/nicolailang/ diff --git a/docker-compose-multiple-networks.yml b/docker-compose-multiple-networks.yml index 09141f2..2d4440e 100644 --- a/docker-compose-multiple-networks.yml +++ b/docker-compose-multiple-networks.yml @@ -7,9 +7,9 @@ services: container_name: ${NGINX_WEB:-nginx-web} restart: always ports: - - "${IP:-0.0.0.0}:80:80" - - "${IP:-0.0.0.0}:443:443" - volumes: + - "${IP:-0.0.0.0}:${DOCKER_HTTP:-80}:80" + - "${IP:-0.0.0.0}:${DOCKER_HTTPS:-443}:443" + volumes: - ${NGINX_FILES_PATH:-./data}/conf.d:/etc/nginx/conf.d - ${NGINX_FILES_PATH:-./data}/vhost.d:/etc/nginx/vhost.d - ${NGINX_FILES_PATH:-./data}/html:/usr/share/nginx/html diff --git a/docker-compose.yml b/docker-compose.yml index 230146e..377a000 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,8 +7,8 @@ services: container_name: ${NGINX_WEB:-nginx-web} restart: always ports: - - "${IP:-0.0.0.0}:80:80" - - "${IP:-0.0.0.0}:443:443" + - "${IP:-0.0.0.0}:${DOCKER_HTTP:-80}:80" + - "${IP:-0.0.0.0}:${DOCKER_HTTPS:-443}:443" volumes: - ${NGINX_FILES_PATH:-./data}/conf.d:/etc/nginx/conf.d - ${NGINX_FILES_PATH:-./data}/vhost.d:/etc/nginx/vhost.d From c10dca890a8bf00290c93e5b04403c6ffb7db8d7 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Fri, 30 Nov 2018 13:07:59 -0200 Subject: [PATCH 2/4] Update HOWTO-Synlogy.md --- Docs/HOWTO-Synlogy.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Docs/HOWTO-Synlogy.md b/Docs/HOWTO-Synlogy.md index 43eab4a..c65eea8 100755 --- a/Docs/HOWTO-Synlogy.md +++ b/Docs/HOWTO-Synlogy.md @@ -1,7 +1,7 @@ ## Port mapping Synology default installs a web server on port 80 blocking certificate generation. -To circumvent this - if you do not need extenral access to the default web server (and you should not expose it anyway) configure your .env to use alternative ports and your router to forward the external official port to the alternative internal ports: +To circumvent this - if you do not need external access to the default web server (and you should not expose it anyway) configure your .env to use alternative ports and your router to forward the external official port to the alternative internal ports: # # Set the local exposed ports for http and https - this will allow you to run with a legacy web From 47b4a7d3c7dc826e0e9fdf85d4f8cef7ba407978 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Fri, 30 Nov 2018 13:11:44 -0200 Subject: [PATCH 3/4] Update HOWTO-Synlogy.md --- Docs/HOWTO-Synlogy.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Docs/HOWTO-Synlogy.md b/Docs/HOWTO-Synlogy.md index c65eea8..4c456f8 100755 --- a/Docs/HOWTO-Synlogy.md +++ b/Docs/HOWTO-Synlogy.md @@ -4,7 +4,7 @@ Synology default installs a web server on port 80 blocking certificate generatio To circumvent this - if you do not need external access to the default web server (and you should not expose it anyway) configure your .env to use alternative ports and your router to forward the external official port to the alternative internal ports: # -# Set the local exposed ports for http and https - this will allow you to run with a legacy web +# Set the local exposed ports for http and https - this will allow you to run with a legacy web # server already installed for local use # # NOTE: For this to function your internet router must forward the official ports to the mapped ports - From 2a9896c2334cc84df0b8dc3b1079479edec0df28 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Fri, 30 Nov 2018 15:58:10 -0200 Subject: [PATCH 4/4] Update .env.sample --- .env.sample | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/.env.sample b/.env.sample index b0e8873..015ac48 100644 --- a/.env.sample +++ b/.env.sample @@ -18,16 +18,6 @@ LETS_ENCRYPT=nginx-letsencrypt # IP=0.0.0.0 -# -# Set the local exposed ports for http and https - this will allow you to run with a legacy web -# server already installed for local use -# -# NOTE: For this to function your internet router must forward the official ports to the mapped ports - -# in this example external port 80 to docker host 81 and external port 443 to docker host 444 -# -#DOCKER_HTTP=81 -#DOCKER_HTTPS=444 - # # Default Network # @@ -95,3 +85,11 @@ NGINX_FILES_PATH=./nginx-data #NGINX_LETSENCRYPT_LOG_DRIVER=json-file #NGINX_LETSENCRYPT_LOG_MAX_SIZE=2m #NGINX_LETSENCRYPT_LOG_MAX_FILE=10 + +# +# Set the local exposed ports for http and https on the Host +# +# NOTE: The default values are 80 and 443, only change this options if you really know what you are doing +# +#DOCKER_HTTP=80 +#DOCKER_HTTPS=443