coreos-home-server/service/nginx/service/nginx-proxy-http.conf.template
Alex Palaistras eda658f99d nginx: Move back to separate UPSTREAM variables
This commit moves the `nginx-proxy-http` service back to separate
`UPSTREAM_HOST`, `UPSTREAM_PORT`, and `UPSTREAM_PATH` variables, which
allows for more granular configuration, e.g. `proxy_redirect` patterns.
2022-10-29 17:24:58 +01:00

27 lines
883 B
Plaintext

server {
listen 80;
server_name ${SERVER_NAME} ${SERVER_NAME_ALT};
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name ${SERVER_NAME} ${SERVER_NAME_ALT};
ssl_certificate /etc/ssl/private/certificates/${SSL_CERT_NAME}.crt;
ssl_certificate_key /etc/ssl/private/certificates/${SSL_CERT_NAME}.key;
include resolver.conf;
set $upstream_endpoint http://${UPSTREAM_HOST}:${UPSTREAM_PORT}${UPSTREAM_PATH};
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass $upstream_endpoint$request_uri;
proxy_redirect http://$upstream_endpoint /;
proxy_redirect http://${SERVER_NAME}:${UPSTREAM_PORT}${UPSTREAM_PATH} /;
}
}