From 20fd185652151546d7a13875a050ab5f6527cca6 Mon Sep 17 00:00:00 2001 From: Jocelyn Le Sage Date: Fri, 2 Nov 2018 10:06:37 -0400 Subject: [PATCH] Added default HTTPs site. --- rootfs/etc/nginx/conf.d/default.conf | 14 ++++++++++++++ rootfs/etc/services.d/nginx/run | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/rootfs/etc/nginx/conf.d/default.conf b/rootfs/etc/nginx/conf.d/default.conf index bc70e8de..f24cbaf7 100644 --- a/rootfs/etc/nginx/conf.d/default.conf +++ b/rootfs/etc/nginx/conf.d/default.conf @@ -36,3 +36,17 @@ server { root /var/www/html; } } + +# Default 443 Host +server { + listen 443 ssl default; + server_name localhost; + + access_log /data/logs/default.log proxy; + + ssl_certificate /data/nginx/dummycert.pem; + ssl_certificate_key /data/nginx/dummykey.pem; + ssl_ciphers aNULL; + + return 444; +} diff --git a/rootfs/etc/services.d/nginx/run b/rootfs/etc/services.d/nginx/run index afeeec1b..830466c6 100755 --- a/rootfs/etc/services.d/nginx/run +++ b/rootfs/etc/services.d/nginx/run @@ -21,5 +21,19 @@ chown root /tmp/nginx # Dynamically generate resolvers file echo resolver $(awk 'BEGIN{ORS=" "} $1=="nameserver" {print $2}' /etc/resolv.conf) ";" > /etc/nginx/conf.d/include/resolvers.conf +# Generate dummy self-signed certificate. +if [ ! -f /data/nginx/dummycert.pem ] || [ ! -f /data/nginx/dummykey.pem ] +then + openssl req \ + -new \ + -newkey rsa:2048 \ + -days 3650 \ + -nodes \ + -x509 \ + -subj '/O=Nginx Proxy Manager/OU=Dummy Certificate/CN=localhost' \ + -keyout /data/nginx/dummykey.pem \ + -out /data/nginx/dummycert.pem +fi + # Run exec nginx