summaryrefslogtreecommitdiffstats
path: root/roles/lists/files/etc/nginx/sites-available/sympa
blob: 89d79f316c915c0461f2d706caf9f1f75fcbec8a (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
81
82
83
84
85
server {
    listen      80;
    listen [::]:80;

    server_name lists.fripost.org;

    include /etc/lacme/nginx.conf;

    access_log /var/log/nginx/lists.access.log;
    error_log  /var/log/nginx/lists.error.log info;

    location / {
        return 301 https://$host$request_uri;
    }
}


server {
    listen      443 ssl http2;
    listen [::]:443 ssl http2;

    server_name  lists.fripost.org;

    access_log /var/log/nginx/lists.access.log;
    error_log  /var/log/nginx/lists.error.log info;

    include snippets/headers.conf;
    add_header Content-Security-Policy
               "default-src 'none'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self'; font-src 'self'; frame-ancestors 'none'; form-action 'self'; base-uri lists.fripost.org";

    include snippets/ssl.conf;
    ssl_certificate     ssl/lists.fripost.org.pem;
    ssl_certificate_key ssl/lists.fripost.org.key;
    include             snippets/lists.fripost.org.hpkp-hdr;

    gzip on;
    gzip_vary on;
    gzip_min_length 256;
    gzip_types application/font-woff application/font-woff2 application/javascript application/json application/xml image/x-icon text/css text/plain;

    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
        alias /etc/sympa/robots.txt;
    }

    location = / {
        return 302 /sympa$args;
    }

    location ^~ /static-sympa/   { expires 30d; try_files $uri =404; alias /usr/share/sympa/static_content/; }
    location ^~ /css-sympa/      { expires 30d; try_files $uri =404; alias /var/lib/sympa/css/; }
    location ^~ /pictures-sympa/ { expires 30d; try_files $uri =404; alias /var/lib/sympa/pictures; }

    location ~* ^/sympa(?:/|$) {
        gzip off; # protect against BREACH

        fastcgi_split_path_info ^(/sympa)(.*)$;
        include snippets/fastcgi.conf;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_pass unix:/run/wwsympa.socket;
    }

    location ~* ^/([^/]+)/?$ {
        return 302 /$1/sympa$args;
    }
    location ~* ^/(?<vhost>[^/]+)/sympa(?:/|$) {
        gzip off; # protect against BREACH

        if (!-f /etc/sympa/$vhost/robot.conf) {
            return 404;
        }

        fastcgi_split_path_info ^(/[^/]+/sympa)(.*)$;
        include snippets/fastcgi.conf;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param SERVER_NAME $vhost;
        fastcgi_pass unix:/run/wwsympa.socket;
    }

    location / {
        return 404;
    }
}