Modifications : etc/nginx/site.d/lhc-wiklou/site.conf
[lhc/ateliers.git] / etc / nginx / site.d / lhc-wiklou / site.conf
1 server_name
2 wiklou.heureux-cyclage.org
3 wiklou.org;
4 index index.php;
5
6 client_body_buffer_size 8k;
7 client_max_body_size 10m;
8
9 location / {
10 # Do this inside of a location so it can be negated
11 location ~ \.php$ {
12 try_files $uri $uri/ =404; # Don't let php execute non-existent php files
13 rewrite ^/index.php/(.*)$ /wiki/$1 permanent;
14 fastcgi_split_path_info ^(.+\.php)(/.+)$;
15 fastcgi_pass unix:/run/php5/fpm/lhc_wiklou;
16 fastcgi_index index.php ;
17 include /etc/nginx/conf.d/fastcgi.conf;
18 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
19 }
20 }
21
22 location /images {
23 # Separate location for images/ so .php execution won't apply
24 location ~ ^/images/thumb/(archive/)?[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ {
25 # Thumbnail handler for MediaWiki
26 # This location only matches on a thumbnail's url
27 # If the file does not exist we use @thumb to run the thumb.php script
28 try_files $uri $uri/ @thumb;
29 }
30 }
31
32 location /images/deleted {
33 # Deny access to deleted images folder
34 deny all;
35 }
36
37 # Deny access to folders MediaWiki has a .htaccess deny in
38 location /cache { deny all; }
39 location /languages { deny all; }
40 location /maintenance { deny all; }
41 location /serialized { deny all; }
42
43 # Just in case, hide .svn and .git too
44 location ~ /.(svn|git)(/|$) { deny all; }
45
46 # Hide any .htaccess files
47 location ~ /.ht { deny all; }
48
49 # Uncomment the following code if you wish to hide the installer/updater
50 ## Deny access to the installer
51 #location /mw-config { deny all; }
52
53 # Handling for the article path
54 location /wiki {
55 include /etc/nginx/conf.d/fastcgi.conf;
56 # article path should always be passed to index.php
57 fastcgi_param SCRIPT_FILENAME $document_root/index.php;
58 fastcgi_split_path_info ^(.+\.php)(/.+)$;
59 fastcgi_pass unix:/run/php5/fpm/lhc_wiklou;
60 fastcgi_index index.php ;
61 }
62
63 # Thumbnail 404 handler, only called by try_files when a thumbnail does not exist
64 location @thumb {
65 # Do a rewrite here so that thumb.php gets the correct arguments
66 rewrite ^/images/thumb/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ /thumb.php?f=$1&width=$2;
67 rewrite ^/images/thumb/archive/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ /thumb.php?f=$1&width=$2&archived=1;
68
69 # Run the thumb.php script
70 include /etc/nginx/conf.d/fastcgi.conf;
71 fastcgi_param SCRIPT_FILENAME $document_root/thumb.php;
72 fastcgi_pass unix:/run/php5/fpm/lhc_wiklou;
73 }
74
75 location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
76 try_files $uri /index.php;
77 expires max;
78 log_not_found off;
79 }
80
81
82 location = /_.gif {
83 expires max;
84 empty_gif;
85 }
86
87 location ^~ /cache/ {
88 deny all;
89 }
90
91 location /dumps {
92 root /var/www/mediawiki/local;
93 autoindex on;
94 }
95