Modification : nginx root configurable.
[lhc/ateliers.git] / etc / nginx / site.d / ptitvelo-www / site.conf
1 server_name
2 ptitvelo.heureux-cyclage.org
3 www.ptitvelo.net
4 ptitvelo.net;
5 root /home/www/data/ptitvelo-www/www;
6
7 client_body_buffer_size 8k;
8 client_max_body_size 10m;
9 location / {
10 index index.html index.htm index.php;
11 }
12 location ~* ^.+.(css|gif|html|ico|jpeg|js|jpg|png|txt|xml)$ {
13 access_log off;
14 expires 30d;
15 log_not_found off;
16 }
17 location ~ /\. {
18 access_log off;
19 deny all;
20 log_not_found off;
21 }
22 location ~ \.php$ {
23 include /etc/nginx/conf.d/fastcgi.conf;
24 set $no_cache "0";
25 if ($request_method !~ ^(GET|HEAD)$) {
26 # NOTE: if non GET/HEAD, don't cache and mark user as uncacheable for 1 second via cookie.
27 set $no_cache "1";
28 }
29 if ($no_cache = "1") {
30 # NOTE: drop no cache cookie if need be (for some reason, add_header fails if included in prior if-block).
31 add_header Set-Cookie "_mcnc=1; Max-Age=2; Path=/";
32 add_header X-Microcachable "0";
33 }
34 if ($http_cookie ~* "_mcnc") {
35 # NOTE: bypass cache if no-cache cookie is set
36 set $no_cache "1";
37 }
38 fastcgi_cache_bypass $no_cache;
39 fastcgi_cache_use_stale updating;
40 fastcgi_cache_valid 200 10s;
41 fastcgi_cache_valid 404 10m;
42 fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
43 fastcgi_index index.php;
44 fastcgi_no_cache $no_cache;
45 fastcgi_param REDIRECT_STATUS 200;
46 # NOTE: PHP only, required if PHP was built with --enable-force-cgi-redirect
47 fastcgi_pass_header Cookie;
48 fastcgi_pass_header Set-Cookie;
49 fastcgi_split_path_info ^(.+\.php)(/.+)$;
50
51 fastcgi_pass unix:/run/php5/fpm/ptitvelo_www;
52 }
53
54 # vim: ft=sh