summaryrefslogtreecommitdiff
path: root/git.rulkc.org/nginx/landau.one
blob: 0e246e690dc243ef3332b6d11aef038b704f6d80 (plain)
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
server {
    server_name landau.one www.landau.one;
    listen 443 ssl http2; # managed by Certbot

    root /var/www/landau.one;
    #try_files $uri;

    index index.html;

    server_tokens off;
    charset utf-8;

    access_log /var/log/nginx/landau.one.access.log;
    error_log  /var/log/nginx/landau.one.error.log warn;

    # Security headers
    add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
    add_header X-Content-Type-Options "nosniff" always;
    add_header X-Frame-Options "SAMEORIGIN" always;
    add_header Referrer-Policy "strict-origin-when-cross-origin" always;
    add_header Permissions-Policy "geolocation=(), microphone=(), camera=()" always;
    # При необходимости: CSP. Начни с report-only, чтобы не сломать рендер.
    # add_header Content-Security-Policy "default-src 'self'; img-src 'self' data: https:; style-src 'self' 'unsafe-inline'; script-src 'self'" always;

    # Сжатие
    gzip on;
    gzip_vary on;
    gzip_comp_level 6;
    gzip_min_length 1024;
    gzip_types text/plain text/css text/xml application/json application/javascript application/xml+rss image/svg+xml;
    # Если сборка nginx с brotli — включи и его (brotli on; brotli_types ...)

    # Чистые URL: /about -> /about.html
    location / {
        try_files $uri $uri/ $uri.html =404;
    }

    # Кеш для хешированных ассетов
    location ~* \.(?:css|js|woff2?|ttf|otf|eot|svg|jpg|jpeg|png|gif|webp|avif|ico)$ {
        expires 1d;
        add_header Cache-Control "public, immutable";
        access_log off;
        try_files $uri =404;
    }

    # HTML и корневые манифесты — всегда свежие
    #location ~* \.(?:html|xml|txt|json|webmanifest)$ {
    #    expires -1;
    #    add_header Cache-Control "no-cache";
    #}

    # Запрет скрытых файлов
    location ~ /\.(?!well-known) {
        deny all;
        access_log off;
        log_not_found off;
    }
    ssl_certificate /etc/letsencrypt/live/git.rulkc.org/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/git.rulkc.org/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot





}
server {
    if ($host = landau.one) {
        return 301 https://$host$request_uri;
    } # managed by Certbot
    if ($host = www.landau.one) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    listen 80;
    server_name landau.one www.landau.one;
    return 404; # managed by Certbot
}