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