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