simplify nginx template
This commit is contained in:
parent
6456bc19ce
commit
41ae856938
|
@ -23,8 +23,8 @@ services:
|
||||||
environment:
|
environment:
|
||||||
- BASE_DOMAIN_NAME=${BASE_DOMAIN_NAME}
|
- BASE_DOMAIN_NAME=${BASE_DOMAIN_NAME}
|
||||||
- ALT_BASE_DOMAIN_NAME=${ALT_BASE_DOMAIN_NAME}
|
- ALT_BASE_DOMAIN_NAME=${ALT_BASE_DOMAIN_NAME}
|
||||||
- DOLLAR=$$
|
|
||||||
- NGINX_ENVSUBST_OUTPUT_DIR=/etc/nginx
|
- NGINX_ENVSUBST_OUTPUT_DIR=/etc/nginx
|
||||||
|
- NGINX_ENVSUBST_FILTER=^(BASE_DOMAIN_NAME|ALT_BASE_DOMAIN_NAME)$$
|
||||||
links:
|
links:
|
||||||
- forgejo
|
- forgejo
|
||||||
- mail
|
- mail
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
|
|
||||||
return 301 https://${DOLLAR}host${DOLLAR}request_uri;
|
return 301 https://$host$request_uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
|
@ -36,12 +36,12 @@ server {
|
||||||
location / {
|
location / {
|
||||||
proxy_pass http://forgejo:3000;
|
proxy_pass http://forgejo:3000;
|
||||||
|
|
||||||
proxy_set_header Connection ${DOLLAR}http_connection;
|
proxy_set_header Connection $http_connection;
|
||||||
proxy_set_header Upgrade ${DOLLAR}http_upgrade;
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
proxy_set_header Host ${DOLLAR}host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP ${DOLLAR}remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For ${DOLLAR}proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_set_header X-Forwarded-Proto ${DOLLAR}scheme;
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
|
||||||
client_max_body_size 512M;
|
client_max_body_size 512M;
|
||||||
}
|
}
|
||||||
|
@ -58,12 +58,12 @@ server {
|
||||||
location / {
|
location / {
|
||||||
proxy_pass http://mail:80;
|
proxy_pass http://mail:80;
|
||||||
|
|
||||||
proxy_set_header Connection ${DOLLAR}http_connection;
|
proxy_set_header Connection $http_connection;
|
||||||
proxy_set_header Upgrade ${DOLLAR}http_upgrade;
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
proxy_set_header Host ${DOLLAR}host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP ${DOLLAR}remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For ${DOLLAR}proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_set_header X-Forwarded-Proto ${DOLLAR}scheme;
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,19 +79,19 @@ server {
|
||||||
proxy_pass http://unix:/forum/nginx.http.sock:;
|
proxy_pass http://unix:/forum/nginx.http.sock:;
|
||||||
|
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Connection ${DOLLAR}http_connection;
|
proxy_set_header Connection $http_connection;
|
||||||
proxy_set_header Upgrade ${DOLLAR}http_upgrade;
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
proxy_set_header Host ${DOLLAR}host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP ${DOLLAR}remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For ${DOLLAR}proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_set_header X-Forwarded-Proto ${DOLLAR}scheme;
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
include /etc/nginx/ssl_listen.conf;
|
include /etc/nginx/ssl_listen.conf;
|
||||||
|
|
||||||
server_name ~^(?<subdomain>.*)${ALT_BASE_DOMAIN_NAME}${DOLLAR};
|
server_name ~^(?<subdomain>.*)${ALT_BASE_DOMAIN_NAME}$;
|
||||||
return 301 https://${DOLLAR}{subdomain}${BASE_DOMAIN_NAME}${DOLLAR}request_uri;
|
return 301 https://${subdomain}${BASE_DOMAIN_NAME}$request_uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue