Got another nginx / mediawiki issue for you brilliant minds. All help
appreciated!
I've got file uploads working, but after the upload is complete, the
File:filename page shows as a 404.
For example:
http://www.mattselznick.com/thehumanitycontinuum/wiki/File:Shure_55s_1951.p…
The section of my nginx conf file for the wiki looks like this:
# Location for the wiki's root
location /thehumanitycontinuum/wiki/ {
try_files $uri $uri/ @mediawiki;
# Do this inside of a location so it can be negated
location ~ \.php$ {
try_files $uri $uri/ =404; # Don't let php execute non-existent php files
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
}
location /thehumanitycontinuum/wiki/images {
# Separate location for images/ so .php execution won't apply
location ~
^/thehumanitycontinuum/wiki/images/thumb/(archive/)?[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$
{
# Thumbnail handler for MediaWiki
# This location only matches on a thumbnail's url
# If the file does not exist we use @thumb to run the thumb.php script
try_files $uri $uri/ @thumb;
}
}
location /thehumanitycontinuum/wiki/images/deleted {
# Deny access to deleted images folder
deny all;
}
# Deny access to folders MediaWiki has a .htaccess deny in
location /thehumanitycontinuum/wiki/cache { deny all; }
location /thehumanitycontinuum/wiki/languages { deny all; }
location /thehumanitycontinuum/wiki/maintenance { deny all; }
location /thehumanitycontinuum/wiki/serialized { deny all; }
# Just in case, hide .svn and .git too
location ~ /.(svn|git)(/|$) { deny all; }
# Hide any .htaccess files
location ~ /.ht { deny all; }
# Uncomment the following code if you wish to hide the installer/updater
## Deny access to the installer
#location /thehumanitycontinuum/wiki/mw-config { deny all; }
# Handling for the article path
location @mediawiki {
include /etc/nginx/fastcgi_params;
# article path should always be passed to index.php
fastcgi_param SCRIPT_FILENAME
$document_root/thehumanitycontinuum/wiki/index.php;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
# Thumbnail 404 handler, only called by try_files when a thumbnail
does not exist
location @thumb {
# Do a rewrite here so that thumb.php gets the correct arguments
rewrite
^/thehumanitycontinuum/wiki/images/thumb/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$
/thehumanitycontinuum/wiki/thumb.php?f=$1&width=$2;
rewrite
^/thehumanitycontinuum/wiki/images/thumb/archive/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$
/thehumanitycontinuum/wiki/thumb.php?f=$1&width=$2&archived=1;
# Run the thumb.php script
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME
$document_root/thehumanitycontinuum/wiki/thumb.php;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
--
Matthew Wayne Selznick
Author, Creator and Creative Services Provider
http://www.mattselznick.com
Get a Free Sampler of My Short Stories, Novels, and Non-Fiction:
http://www.mattselznick.com/free-ebook