Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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!

share|improve this question
1  
is it a pre 3.5 install? The blogs.dir was deprecated in 3.5. –  birgire Sep 29 '13 at 15:31
    
Yep. I solved the problem by updating the way files are loaded to the 3.5 system by following halfelf.org/2012/dumping-ms-files –  Philip Seyfi Sep 30 '13 at 0:56

1 Answer 1

up vote 1 down vote accepted

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:

  • Move images from blogs.dir/#/files/ to /uploads/sites/#/
  • Change WordPress settings so it doesn't look in /files/ but in /uploads/sites/#/
  • In .htaccess or your nginx config file remove ms-files.php line/section
  • Search/replace the posts table for each site, changing /files/ to /uploads/sites/#/
share|improve this answer
    
great to hear you solved it, it would be nice if you could explain it a little bit more, because if this external link goes down, then the future readers of this answer will not know how you solved it ;-) –  birgire Sep 30 '13 at 8:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.