server-setup/nginx_templates/conf.d/default.conf.template

98 lines
2.3 KiB
Plaintext

server {
listen 80;
return 301 https://$host$request_uri;
}
server {
include /etc/nginx/ssl_listen.conf;
location / {
error_page 404 /404.html;
root /var/www/html;
index index.html index.htm;
}
location /.well-known/acme-challenge {
root /var/www;
}
location ~ /\.(?!well-known).* {
return 404;
access_log off;
log_not_found off;
}
}
server {
include /etc/nginx/ssl_listen.conf;
server_name git.${BASE_DOMAIN_NAME};
location /.well-known/acme-challenge {
root /var/www;
}
location / {
proxy_pass http://forgejo:3000;
proxy_set_header Connection $http_connection;
proxy_set_header Upgrade $http_upgrade;
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;
client_max_body_size 512M;
}
}
server {
include /etc/nginx/ssl_listen.conf;
location /.well-known/acme-challenge {
root /var/www;
}
server_name mail.${BASE_DOMAIN_NAME};
location / {
proxy_pass http://mail:80;
proxy_set_header Connection $http_connection;
proxy_set_header Upgrade $http_upgrade;
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;
}
}
server {
include /etc/nginx/ssl_listen.conf;
location /.well-known/acme-challenge {
root /var/www;
}
server_name forum.${BASE_DOMAIN_NAME};
location / {
proxy_pass http://unix:/forum/nginx.http.sock:;
proxy_http_version 1.1;
proxy_set_header Connection $http_connection;
proxy_set_header Upgrade $http_upgrade;
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;
}
}
server {
include /etc/nginx/ssl_listen.conf;
server_name ~^(?<subdomain>.*)${ALT_BASE_DOMAIN_NAME}$;
return 301 https://${subdomain}${BASE_DOMAIN_NAME}$request_uri;
}