Added resolvers auto generation in order for hostnames to work

This commit is contained in:
Jamie Curnow 2018-10-19 16:24:44 +10:00
parent dba4340548
commit eb391959aa
3 changed files with 11 additions and 0 deletions

View File

@ -0,0 +1 @@
# Intentionally blank

View File

@ -51,6 +51,10 @@ http {
access_log /data/logs/default.log proxy;
# Dynamically generated resolvers file
include /etc/nginx/conf.d/include/resolvers.conf;
# Files generated by NPM
include /etc/nginx/conf.d/*.conf;
include /data/nginx/proxy_host/*.conf;
include /data/nginx/redirection_host/*.conf;
@ -59,6 +63,7 @@ http {
}
stream {
# Files generated by NPM
include /data/nginx/stream/*.conf;
}

View File

@ -1,5 +1,6 @@
#!/usr/bin/with-contenv bash
# Create required folders
mkdir -p /tmp/nginx/body \
/var/log/nginx \
/data/nginx \
@ -17,4 +18,8 @@ mkdir -p /tmp/nginx/body \
touch /var/log/nginx/error.log && chmod 777 /var/log/nginx/error.log
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
# Run
exec nginx