I have a WordPress subdomain multisite install in the /blog
subdirectory running on an nginx server. Everything works fine except files which do upload correctly but are not accessible via their url.
The part of the config concerning the files is:
location ~ ^/files/(.*)$ {
try_files /blog/wp-content/blogs.dir/$blogid/$uri /blog/wp-includes/ms-files.php?file=$1 ;
access_log off; log_not_found off; expires max;
}
#avoid php readfile()
location ^~ /blogs.dir {
internal;
alias /var/www/example/public_html/blog/wp-content/blogs.dir;
access_log off; log_not_found off; expires max;
}
and
map $http_host $blogid {
default -999;
#blog
example.com 1;
a.example.com 2;
b.example.com 3;
c.example.com 4;
}
The WordPress sites have the following settings:
Upload Path: wp-content/blogs.dir/1/files/
Upload Url Path: http://example.com/blog/files
Fileupload Url: http://example.com/blog/files
The number in the Upload Path is of course different for each site.
When I try to upload a file to any blogpost of any of the sites it does appear in the /blog/wp-content/blogs.dir/#/files/
folder but if I try to access /blog/wp-content/files/test.png
it throws 404
Any ideas? Thanks!
I solved the problem by upgrading the way files are uploaded and displayed to the new WordPress 3.5 method.
A more detailed tutorial can be found at http://halfelf.org/2012/dumping-ms-files/ but the basic steps are as follows:
blogs.dir/#/files/
to/uploads/sites/#/
/files/
but in/uploads/sites/#/
/files/
to/uploads/sites/#/