public
Last active

nginx config for multisite in a subdirectory

  • Download Gist
gistfile1.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
# site path: /var/www/wp.dev/
# wp path: /var/www/wp.dev/core/
 
# site url: http://wp.dev/core/
# wp url: http://wp.dev/core/
 
upstream php {
server unix:/var/run/phpfpm.sock;
}
 
server {
server_name wp.dev;
root /var/www/wp.dev;
access_log /var/log/nginx/wp.dev-access.log;
error_log /var/log/nginx/wp.dev-error.log;
index index.html index.php;
 
rewrite ^/core/([_0-9a-zA-Z-]+)/(xmlrpc\.php|wp-[0-9a-z-]+\.php) /core/$2;
rewrite ^/core/([_0-9a-zA-Z-]+)/(wp-(admin|content|includes).*) /core/$2;
 
location / {
try_files $uri $uri/ /index.php;
}
 
location ~ \.php {
include /etc/nginx/fastcgi_params;
fastcgi_pass php;
}
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.