aboutsummaryrefslogtreecommitdiffstats
path: root/templates/homepage/usr_local_etc_nginx_nginx.conf.j2
blob: ee4540597a002e318ad0fad1ce99b2e1d41e0b98 (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
worker_processes auto;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    keepalive_timeout  65;

    gzip on;
    gzip_vary on;
    gzip_proxied any;
    gzip_comp_level 6;
    gzip_min_length 256;

    # Compress sensible, text-based response types (HTML is covered by default)
    gzip_types
        text/plain
        text/css
        text/xml
        text/javascript
        application/javascript
        application/json
        application/ld+json
        application/xml
        application/rss+xml
        application/atom+xml
        image/svg+xml;

    server {
        listen 80 default_server;
        server_name _;

        root /var/www;

        index index.html;

        # Migration redirects from legacy site
        location ~ ^/archive(?:/(.*))?$ {
            return 307 /posts/$1$is_args$args;
        }
        location = /feed.xml {
            # Serve atom.xml content at the legacy feed.xml URL (no redirect)
            rewrite ^ /atom.xml break;
        }

        location / {
            try_files $uri $uri.html $uri/ =404;
        }
    }
}