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