156 lines
4.3 KiB
Plaintext
156 lines
4.3 KiB
Plaintext
############################################
|
|
# config file for ${name_site}
|
|
############################################
|
|
|
|
server {
|
|
server_name ${name_site}.tryton.geeraert.eu www.${name_site}.tryton.geeraert.eu;
|
|
|
|
|
|
%{~ if redirect_to_root_domain~}
|
|
if ($host = www.${name_site}.tryton.geeraert.eu) {
|
|
return 301 https://${name_site}.geeraert.eu$request_uri;
|
|
}
|
|
|
|
|
|
if ($host = ${name_site}.tryton.geeraert.eu) {
|
|
return 301 https://${name_site}.geeraert.eu$request_uri;
|
|
}
|
|
|
|
%{~ endif ~}
|
|
%{ if redirect_to_root_domain != true }
|
|
|
|
location / {
|
|
set $backend_${name_site} "${name_service}";
|
|
proxy_pass %{ if proxy_pass_https}https%{else}http%{ endif }://$backend_${name_site};
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Host $host;
|
|
${extra-value-location}
|
|
|
|
proxy_intercept_errors on;
|
|
# 502 = DNS can't resolve / Service down
|
|
# 504 = Gateway Timeout
|
|
error_page 502 504 = @backup_site;
|
|
|
|
}
|
|
location @backup_site {
|
|
proxy_pass http://1.1.1.1;
|
|
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Host $host;
|
|
}
|
|
location /.well-known/acme-challenge/ {
|
|
root /var/www/certbot;
|
|
}
|
|
%{ endif }
|
|
|
|
access_log /var/log/nginx/access.log my_custom_format;
|
|
access_log /var/log/nginx/ip_audit.log ip_audit;
|
|
access_log /var/log/nginx/backend_debug.log backend_debug;
|
|
${extra-value}
|
|
%{~ if http2_bool~}
|
|
http2 on;
|
|
ssl_protocols TLSv1.2;
|
|
%{~ endif ~}
|
|
|
|
listen 443 ssl;
|
|
%{~ if listen_port_80_bool~}
|
|
listen 80;
|
|
%{~ endif ~}
|
|
|
|
ssl_certificate /etc/nginx/ssl/live/tryton.geeraert.eu/fullchain.pem;
|
|
ssl_certificate_key /etc/nginx/ssl/live/tryton.geeraert.eu/privkey.pem;
|
|
|
|
|
|
|
|
}
|
|
%{~ if redirect_to_https_bool~}
|
|
|
|
server {
|
|
if ($host = www.${name_site}.tryton.geeraert.eu) {
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
|
|
|
|
if ($host = ${name_site}.tryton.geeraert.eu) {
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
server_name www.${name_site}.tryton.geeraert.eu ${name_site}.tryton.geeraert.eu ;
|
|
listen 80;
|
|
return 404;
|
|
|
|
}
|
|
%{~ endif ~}
|
|
|
|
|
|
|
|
|
|
|
|
############################################
|
|
# config file for ${name_site}
|
|
############################################
|
|
|
|
server {
|
|
server_name ${name_site}.geeraert.eu www.${name_site}.geeraert.eu;
|
|
|
|
location / {
|
|
set $backend_root_${name_site} "${name_service}";
|
|
proxy_pass %{ if proxy_pass_https}https%{else}http%{ endif }://$backend_root_${name_site};
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Host $host;
|
|
${extra-value-location}
|
|
|
|
proxy_intercept_errors on;
|
|
# 502 = DNS can't resolve / Service down
|
|
# 504 = Gateway Timeout
|
|
error_page 502 504 = @backup_site;
|
|
|
|
}
|
|
location @backup_site {
|
|
proxy_pass http://1.1.1.1;
|
|
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Host $host;
|
|
}
|
|
location /.well-known/acme-challenge/ {
|
|
root /var/www/certbot;
|
|
}
|
|
|
|
|
|
access_log /var/log/nginx/access.log my_custom_format;
|
|
access_log /var/log/nginx/ip_audit.log ip_audit;
|
|
access_log /var/log/nginx/backend_debug.log backend_debug;
|
|
${extra-value}
|
|
%{~ if http2_bool~}
|
|
http2 on;
|
|
ssl_protocols TLSv1.2;
|
|
%{~ endif ~}
|
|
|
|
listen 443 ssl;
|
|
%{~ if listen_port_80_bool~}
|
|
listen 80;
|
|
%{~ endif ~}
|
|
|
|
ssl_certificate /etc/nginx/ssl/live/geeraert.eu/fullchain.pem;
|
|
ssl_certificate_key /etc/nginx/ssl/live/geeraert.eu/privkey.pem;
|
|
|
|
|
|
|
|
}
|
|
%{~ if redirect_to_https_bool~}
|
|
|
|
server {
|
|
if ($host = www.${name_site}.geeraert.eu) {
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
|
|
|
|
if ($host = ${name_site}.geeraert.eu) {
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
server_name www.${name_site}.geeraert.eu ${name_site}.geeraert.eu ;
|
|
listen 80;
|
|
return 404;
|
|
|
|
}
|
|
%{~ endif ~}
|