Modifications : etc/nginx/org/chatperche/www/common.conf.m4
[lhc/admin.git] / srv / ateliers / etc / nginx / org / chatperche / www / common.conf.m4
1 server_name
2 www.chatperche.org
3 chatperche.heureux-cyclage.org;
4 root /home/www/data/org/chatperche/www/www;
5
6 rewrite /wp-admin$ $scheme://$host$uri/ permanent;
7 # Add trailing slash to */wp-admin requests.
8 location = /wp-admin/ {
9 return 301 /wp-admin/index.php?$args;
10 }
11 location / {
12 if ($host = "www.chatperche.org") {
13 return 302 "$scheme://ateliervelo.free.fr/";
14 }
15 index index.html index.htm index.php;
16 try_files $uri $uri/ /index.php?$args;
17 }
18 location ~* ^.+\.(css|gif|html|ico|jpeg|js|jpg|png|txt|xml)$ {
19 access_log off;
20 expires 30d;
21 log_not_found off;
22 }
23 location ~ /\. {
24 access_log off;
25 deny all;
26 log_not_found off;
27 }
28 location ~ \.php(|/.+)$ {
29 include /etc/nginx/conf.d/fastcgi.conf;
30 set $no_cache "0";
31 if ($request_method !~ ^(GET|HEAD)$) {
32 # NOTE: if non GET/HEAD, don't cache and mark user as uncacheable for 1 second via cookie.
33 set $no_cache "1";
34 }
35 if ($no_cache = "1") {
36 # NOTE: drop no cache cookie if need be (for some reason, add_header fails if included in prior if-block).
37 add_header Set-Cookie "_mcnc=1; Max-Age=2; Path=/";
38 add_header X-Microcachable "0";
39 }
40 if ($http_cookie ~* "_mcnc") {
41 # NOTE: bypass cache if no-cache cookie is set
42 set $no_cache "1";
43 }
44 fastcgi_cache_bypass $no_cache;
45 fastcgi_cache_use_stale updating;
46 fastcgi_cache_valid 200 10s;
47 fastcgi_cache_valid 404 10m;
48 fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
49 fastcgi_index index.php;
50 fastcgi_no_cache $no_cache;
51 fastcgi_param REDIRECT_STATUS 200;
52 # NOTE: PHP only, required if PHP was built with --enable-force-cgi-redirect
53 fastcgi_pass_header Cookie;
54 fastcgi_pass_header Set-Cookie;
55 fastcgi_split_path_info ^(.+\.php)(/.+)$;
56 try_files $fastcgi_script_name =404;
57 # Check for path info security issue
58 fastcgi_pass unix:CAT(sys/php5/fpm/org/chatperche/www/socket);
59 }
60 # vim: ft=sh