Fix port substitution and add support for static files
This commit is contained in:
parent
ab87bc1144
commit
6293b45fbb
|
@ -5,11 +5,12 @@ CERT_PATH="/snikket/letsencrypt/live/$SNIKKET_DOMAIN/cert.pem"
|
||||||
export SNIKKET_TWEAK_HTTP_PORT=${SNIKKET_TWEAK_HTTP_PORT-80}
|
export SNIKKET_TWEAK_HTTP_PORT=${SNIKKET_TWEAK_HTTP_PORT-80}
|
||||||
export SNIKKET_TWEAK_HTTPS_PORT=${SNIKKET_TWEAK_HTTPS_PORT-443}
|
export SNIKKET_TWEAK_HTTPS_PORT=${SNIKKET_TWEAK_HTTPS_PORT-443}
|
||||||
export SNIKKET_TWEAK_INTERNAL_HTTP_PORT=${SNIKKET_TWEAK_INTERNAL_HTTP_PORT-5280}
|
export SNIKKET_TWEAK_INTERNAL_HTTP_PORT=${SNIKKET_TWEAK_INTERNAL_HTTP_PORT-5280}
|
||||||
|
export SNIKKET_TWEAK_PORTAL_INTERNAL_HTTP_PORT=${SNIKKET_TWEAK_PORTAL_INTERNAL_HTTP_PORT-8000}
|
||||||
|
|
||||||
while sleep 10; do
|
while sleep 10; do
|
||||||
if test -f "$CERT_PATH"; then
|
if test -f "$CERT_PATH"; then
|
||||||
for proto in http https; do
|
for proto in http https; do
|
||||||
envsubst '$SNIKKET_DOMAIN $SNIKKET_TWEAK_HTTP_PORT $SNIKKET_TWEAK_HTTPS_PORT $SNIKKET_TWEAK_INTERNAL_HTTP_PORT' \
|
envsubst '$SNIKKET_DOMAIN $SNIKKET_TWEAK_HTTP_PORT $SNIKKET_TWEAK_HTTPS_PORT $SNIKKET_TWEAK_INTERNAL_HTTP_PORT $SNIKKET_TWEAK_PORTAL_INTERNAL_HTTP_PORT' \
|
||||||
< /etc/nginx/templates/$proto \
|
< /etc/nginx/templates/$proto \
|
||||||
> /etc/nginx/sites-enabled/$proto;
|
> /etc/nginx/sites-enabled/$proto;
|
||||||
done
|
done
|
||||||
|
|
|
@ -6,15 +6,23 @@ server {
|
||||||
server_name groups.${SNIKKET_DOMAIN};
|
server_name groups.${SNIKKET_DOMAIN};
|
||||||
server_name share.${SNIKKET_DOMAIN};
|
server_name share.${SNIKKET_DOMAIN};
|
||||||
|
|
||||||
|
root /var/www/html;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
|
try_files $uri @portal;
|
||||||
|
}
|
||||||
|
|
||||||
|
location @portal {
|
||||||
|
proxy_pass http://localhost:${SNIKKET_TWEAK_PORTAL_INTERNAL_HTTP_PORT};
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto https;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /_/ {
|
||||||
proxy_pass http://localhost:${SNIKKET_TWEAK_INTERNAL_HTTP_PORT}/;
|
proxy_pass http://localhost:${SNIKKET_TWEAK_INTERNAL_HTTP_PORT}/;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_set_header X-Forwarded-Proto http;
|
proxy_set_header X-Forwarded-Proto https;
|
||||||
}
|
|
||||||
|
|
||||||
location ^~ /.well-known/acme-challenge {
|
|
||||||
allow all;
|
|
||||||
alias /var/www/html/.well-known/acme-challenge;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,15 +15,21 @@ server {
|
||||||
server_name groups.${SNIKKET_DOMAIN};
|
server_name groups.${SNIKKET_DOMAIN};
|
||||||
server_name share.${SNIKKET_DOMAIN};
|
server_name share.${SNIKKET_DOMAIN};
|
||||||
|
|
||||||
|
root /var/www/html;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
proxy_pass http://localhost:8000/;
|
try_files $uri @portal;
|
||||||
|
}
|
||||||
|
|
||||||
|
location @portal {
|
||||||
|
proxy_pass http://localhost:${SNIKKET_TWEAK_PORTAL_INTERNAL_HTTP_PORT};
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_set_header X-Forwarded-Proto https;
|
proxy_set_header X-Forwarded-Proto https;
|
||||||
}
|
}
|
||||||
|
|
||||||
location /_/ {
|
location /_/ {
|
||||||
proxy_pass http://localhost:5280/;
|
proxy_pass http://localhost:${SNIKKET_TWEAK_INTERNAL_HTTP_PORT}/;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_set_header X-Forwarded-Proto https;
|
proxy_set_header X-Forwarded-Proto https;
|
||||||
|
|
Loading…
Reference in New Issue