Skip to content

Instantly share code, notes, and snippets.

@zamoose
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zamoose/350674aed5c01ba9072c to your computer and use it in GitHub Desktop.
Save zamoose/350674aed5c01ba9072c to your computer and use it in GitHub Desktop.
map $uri $blogname{
~^(?P<blogpath>/[^/]+/)files/(.*) $blogpath ;
}
map $blogname $blogid{
default -999;
#Ref: http://wordpress.org/extend/plugins/nginx-helper/
#include /var/www/wordpress/wp-content/plugins/nginx-helper/map.conf ;
}
[...]
location ~ ^(/[^/]+/)?files/(.+) {
try_files /wp-content/blogs.dir/$blogid/files/$2 /wp-includes/ms-files.php?file=$2 ;
access_log off;
log_not_found off;
expires max;
}
#avoid php readfile()
location ^~ /blogs.dir {
internal;
alias /var/www/example.com/htdocs/wp-content/blogs.dir ;
access_log off;
log_not_found off;
expires max;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment