|
@ -1,13 +1,15 @@ |
|
|
map $uri $blogname{ |
|
|
map $uri $blogname{ |
|
|
~^(?<blogpath>/[^/]+/)files/(.*) $blogpath; |
|
|
~^(?<blogpath>/[^/]+/)files/(.*) $blogpath; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
map $blogname $blogid{ |
|
|
map $blogname $blogid{ |
|
|
default ""; |
|
|
default -999; |
|
|
|
|
|
|
|
|
#Add list of blogs with their ids. SEE "FILE-HANDLING" SECTION. |
|
|
# Must Read - http://rtcamp.com/tutorials/nginx-maps-wordpress-multisite-static-files-handling/ |
|
|
#/site1/ 2; |
|
|
# example.com/site1/ 2; |
|
|
#/site2/ 3; |
|
|
# example.com/site2/ 3; |
|
|
|
|
|
|
|
|
|
|
|
include /var/www/example.com/htdocs/wp-content/plugins/nginx-helper/map.conf; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
server { |
|
|
server { |
|
@ -19,8 +21,8 @@ server { |
|
|
root /var/www/example.com/htdocs; |
|
|
root /var/www/example.com/htdocs; |
|
|
index index.php; |
|
|
index index.php; |
|
|
|
|
|
|
|
|
location ~ ^(/[^/]+/)?files/(.+) { |
|
|
location ~ ^(/[^/]+/)?files/(?<rt_file>.+) { |
|
|
try_files /wp-content/blogs.dir/$blogid/files/$2 /wp-includes/ms-files.php?file=$2; |
|
|
try_files /wp-content/blogs.dir/$blogid/files/$rt_file /wp-includes/ms-files.php?file=$rt_file; |
|
|
access_log off; log_not_found off; expires max; |
|
|
access_log off; log_not_found off; expires max; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|