-
Notifications
You must be signed in to change notification settings - Fork 8
/
nginx.conf
60 lines (46 loc) ยท 1.31 KB
/
nginx.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# v2 - MODIFIED (Discord redirect)
server {
root /usr/share/nginx/html;
index index.html;
# Preserves port in redirects
absolute_redirect off;
# Gzip
gzip on;
gzip_types text/plain text/css application/javascript application/json image/svg+xml;
gzip_min_length 1000;
gzip_comp_level 6;
# Security headers
add_header X-Content-Type-Options nosniff;
add_header X-Frame-Options SAMEORIGIN;
add_header X-XSS-Protection "1; mode=block";
# Remove trailing slashes
rewrite ^/(.*)/$ /$1 permanent;
# Redirect /index and /index.html to /
rewrite ^/index\.html$ / permanent;
rewrite ^/index$ / permanent;
# Redirect index.html to the path itself
rewrite ^/(.*)/index\.html$ /$1 permanent;
# Remove .html extension - except 404.html
rewrite ^/(?!404)(.+)\.html$ /$1 permanent;
location /.well-known/acme-challenge/ {
set $traefik_host traefik;
if ($hostname ~ "localhost") {
set $traefik_host 127.0.0.1:8080; # Fallback for local development
}
proxy_pass http://$traefik_host;
proxy_set_header Host $host;
}
location /discord {
return 301 https://discord.gg/5Z28wjTeyh;
}
location / {
try_files $uri $uri.html $uri/index.html =404;
}
error_page 404 /404.html;
location = /404.html {
internal;
}
location = /404 {
internal;
}
}