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