summaryrefslogtreecommitdiffstats
path: root/roles/webmail/files/etc/nginx/sites-available/roundcube
blob: 1f347c5fdcf7ae0449d34617833eba3f34f66440 (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
server {

    listen      80;
    listen [::]:80;

    server_name    mail.fripost.org;
    server_name webmail.fripost.org;

    include snippets/acme-challenge.conf;

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

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


server {
    listen      443 spdy;
    listen [::]:443 spdy;

    server_name    mail.fripost.org;
    server_name webmail.fripost.org;

    root         /var/lib/roundcube;

    include snippets/headers.conf;
    add_header Content-Security-Policy
               "default-src 'none'; child-src 'self'; frame-src 'self'; connect-src 'self'; object-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src * data:; font-src 'self'; reflected-xss block; referrer no-referrer-when-downgrade; frame-ancestors 'self'; form-action 'self'; base-uri mail.fripost.org webmail.fripost.org";

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

    location = /favicon.ico {
        root          /usr/share/roundcube/skins/default/images;
        log_not_found off;
        access_log    off;
        expires       max;
    }

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

    # Deny all attempts to access hidden files, or files under hidden
    # directories.
    location ~ /\. { return 404; }

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

    index index.php;
    client_max_body_size 64m;
    location = /index.php {
        include snippets/fastcgi-php-ssl.conf;

        # From /var/lib/roundcube/.htaccess
        fastcgi_param PHP_VALUE "upload_max_filesize=25M
                                 post_max_size=30M
                                 memory_limit=64M
                                 session.gc_maxlifetime=21600
                                 session.gc_divisor=500
                                 session.gc_probability=1";
        fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root:/usr/share/roundcube:/etc/roundcube:/var/log/roundcube:/usr/share/php:/usr/share/javascript:/usr/share/tinymce:/usr/share/misc/magic
                                       upload_tmp_dir=$document_root/temp";
    }

    # Security rules
    location ~ ^/(README|INSTALL|LICENSE|CHANGELOG|UPGRADING)$ {
        return 404;
    }
    location ~ ^/(bin|SQL)/ {
        return 404;
    }
}