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

99 lines
2.3 KiB
Plaintext
Raw Normal View History

2024-07-04 06:40:30 +00:00
server {
listen 80;
listen [::]:80;
2024-07-04 06:40:30 +00:00
2024-07-05 02:15:01 +00:00
return 301 https://$host$request_uri;
2024-07-04 06:40:30 +00:00
}
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;
2024-07-05 02:15:01 +00:00
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;
2024-07-04 06:40:30 +00:00
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;
2024-07-05 02:15:01 +00:00
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;
2024-07-04 06:40:30 +00:00
}
}
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;
2024-07-05 02:15:01 +00:00
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;
2024-07-04 06:40:30 +00:00
}
}
server {
include /etc/nginx/ssl_listen.conf;
2024-07-05 02:15:01 +00:00
server_name ~^(?<subdomain>.*)${ALT_BASE_DOMAIN_NAME}$;
return 301 https://${subdomain}${BASE_DOMAIN_NAME}$request_uri;
2024-07-04 06:40:30 +00:00
}