Commit 5f34b859 authored by Valian's avatar Valian
Browse files

fixed newlines and added option, true by default

parent 4e041d3c
FROM openresty/openresty:alpine-fat
# allowed domains should be lua match pattern
ENV DIFFIE_HELLMAN='' ALLOWED_DOMAINS='.*' AUTO_SSL_VERSION='0.11.1'
ENV DIFFIE_HELLMAN='' ALLOWED_DOMAINS='.*' AUTO_SSL_VERSION='0.11.1' FORCE_HTTPS='true' SITES=''
# Here we install open resty and generate dhparam.pem file.
# You can specify DIFFIE_HELLMAN=true to force regeneration of that file on first run
......
......@@ -26,8 +26,9 @@ Available configuration options:
| --- | --- | ---|
| ALLOWED_DOMAINS | `(www\|api).example.com`, `example.com`, `([a-z]+.)?example.com` | [lua pattern](http://lua-users.org/wiki/PatternsTutorial) of allowed domains. Internally, we're using `string.match`. By default we accept all domains |
| DIFFIE_HELLMAN | `true` | Force regeneration of `dhparam.pem`. If not specified, default one is used. |
| SITES | `db.com=localhost:5432;*.app.com=localhost:8080`, `_=localhost:8080` | Shortcut for defining multiple proxies, in form of `domain1=endpoint1;domain2=endpoint2`. Default template for proxy is [here](https://github.com/Valian/docker-nginx-auto-ssl/blob/master/snippets/server-proxy.conf). Name `_` means default server, just like in nginx configuration |
| SITES | `db.com=localhost:5432; *.app.com=localhost:8080`, `_=localhost:8080` | Shortcut for defining multiple proxies, in form of `domain1=endpoint1; domain2=endpoint2`. Default template for proxy is [here](https://github.com/Valian/docker-nginx-auto-ssl/blob/master/snippets/server-proxy.conf). Name `_` means default server, just like in nginx configuration |
| FORCE_HTTPS | `true`, `false` | If `true`, automatically adds location to `resty-server-http.conf` redirecting traffic from http to https. `true` by default. |
If you want to proxy multiple sites (probably the most common case, that's why I've made it possible to achieve without custom configuration):
......
......@@ -49,6 +49,11 @@ elif [ ! "$(ls -A ${NGINX_CONF_DIR})" ]; then
fi
if [ "$FORCE_HTTPS" == "true" ]; then
echo "include force-https.conf;" >> ${RESTY_CONF_DIR}/resty-server-http.conf
fi
# let's substitute $ALLOWED_DOMAINS into OpenResty configuration
envsubst '$ALLOWED_DOMAINS' \
< ${RESTY_CONF_DIR}/resty-http.conf \
......
location / {
return 301 https://$host$request_uri;
}
......@@ -47,4 +47,4 @@ server {
auto_ssl:hook_server()
}
}
}
\ No newline at end of file
}
......@@ -3,4 +3,4 @@ location /.well-known/acme-challenge/ {
content_by_lua_block {
auto_ssl:challenge_server()
}
}
\ No newline at end of file
}
......@@ -6,4 +6,4 @@ ssl_certificate_by_lua_block {
ssl_certificate /etc/ssl/resty-auto-ssl-fallback.crt;
ssl_certificate_key /etc/ssl/resty-auto-ssl-fallback.key;
include ssl.conf;
\ No newline at end of file
include ssl.conf;
......@@ -15,4 +15,4 @@ server {
location = /50x.html {
root /usr/local/openresty/nginx/html;
}
}
\ No newline at end of file
}
......@@ -15,4 +15,4 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
\ No newline at end of file
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment