2f811b65b4542fee0577935cb86f74868f8dd83f
[lhc/ateliers.git] / etc / nginx / site.d / roundcube / site.conf
1 server_name
2 roundcube.heureux-cyclage.org
3 roundcube.changedechaine.org
4 roundcube.cyclocoop.org
5 roundcube.lesjantesdunord.org
6 roundcube.ptitvelo.net
7 roundcube.veli-velo.org;
8
9 client_body_buffer_size 8k;
10 client_max_body_size 10m;
11
12 location = / {
13 root /usr/share/roundcube;
14 index index.php;
15 }
16 location ~ /\. {
17 access_log off;
18 deny all;
19 log_not_found off;
20 }
21 location = /favicon.ico {
22 root /usr/share/roundcube/skins/default/images/;
23 access_log off;
24 expires max;
25 log_not_found off;
26 }
27 location = /robots.txt {
28 access_log off;
29 allow all;
30 log_not_found off;
31 }
32 location ~ ^/(README|INSTALL|LICENSE|CHANGELOG|UPGRADING)$ {
33 deny all;
34 }
35 location ~ ^/(bin|SQL)/ {
36 deny all;
37 }
38 location ~ ^/images/.+\.(png) {
39 root /home/www/data/roundcube;
40 access_log off;
41 expires 30d;
42 log_not_found off;
43 }
44 location ~* ^.+\.(css|gif|html|ico|jpeg|js|jpg|png|txt|xml)$ {
45 root /usr/share/roundcube;
46 access_log off;
47 expires 30d;
48 log_not_found off;
49 }
50 location ~* ^.+\.php(|/.*)$ {
51 root /usr/share/roundcube;
52 include /etc/nginx/conf.d/fastcgi.conf;
53 set $no_cache "0";
54 if ($request_method !~ ^(GET|HEAD)$) {
55 # NOTE: if non GET/HEAD, don't cache and mark user as uncacheable for 1 second via cookie.
56 set $no_cache "1";
57 }
58 if ($no_cache = "1") {
59 # NOTE: drop no cache cookie if need be (for some reason, add_header fails if included in prior if-block).
60 add_header Set-Cookie "_mcnc=1; Max-Age=2; Path=/";
61 add_header X-Microcachable "0";
62 }
63 if ($http_cookie ~* "_mcnc") {
64 # NOTE: bypass cache if no-cache cookie is set
65 set $no_cache "1";
66 }
67 fastcgi_cache_bypass $no_cache;
68 fastcgi_cache_use_stale updating;
69 fastcgi_cache_valid 200 10s;
70 fastcgi_cache_valid 404 10m;
71 fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
72 fastcgi_index index.php;
73 fastcgi_split_path_info ^(.+\.php)(/.+)$;
74 fastcgi_param PATH_INFO $fastcgi_path_info;
75 fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
76 fastcgi_param RCMAIL_CONFIG_DIR /etc/roundcube;
77 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
78 fastcgi_no_cache $no_cache;
79 fastcgi_param REDIRECT_STATUS 200;
80 # NOTE: PHP only, required if PHP was built with --enable-force-cgi-redirect
81 fastcgi_pass_header Cookie;
82 fastcgi_pass_header Set-Cookie;
83
84 fastcgi_pass unix:/run/php5/fpm/roundcube;
85 }
86
87 # vim: ft=sh