Created
August 19, 2014 20:38
-
-
Save fergbrain/c2ca56dcecc82938dceb to your computer and use it in GitHub Desktop.
WordPress Multiuser Configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#File: /etc/nginx/sites-available/commonWP.example.pw; | |
index index.php; | |
#fastcgi_cache start | |
set $skip_cache 0; | |
# POST requests and urls with a query string should always go to PHP | |
if ($request_method = POST) { | |
set $skip_cache 1; | |
} | |
if ($query_string != "") { | |
set $skip_cache 1; | |
} | |
# Don't cache uris containing the following segments | |
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") { | |
set $skip_cache 1; | |
} | |
# Don't use the cache for logged in users or recent commenters | |
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") { | |
set $skip_cache 1; | |
} | |
location / { | |
index index.php index.html; | |
try_files $uri $uri/ /index.php?$args ; | |
} | |
client_max_body_size 200m; | |
location ~ \.php$ { | |
try_files $uri /index.php; | |
include /etc/nginx/fastcgi_params; | |
fastcgi_pass unix:/var/run/php5-fpm.sock; | |
fastcgi_cache_bypass $skip_cache; | |
fastcgi_no_cache $skip_cache; | |
fastcgi_cache WORDPRESS; | |
fastcgi_cache_valid 60m; | |
} | |
location ~ /purge(/.*) { | |
fastcgi_cache_purge WORDPRESS "$scheme$request_method$host$1"; | |
} | |
#WPMU Files | |
location ~ ^/files/(.*)$ { | |
try_files /wp-content/blogs.dir/$blogid/$uri /wp-includes/ms-files.php?file=$1 ; | |
access_log off; log_not_found off; expires max; | |
} | |
#WPMU x-sendfile to avoid php readfile() | |
location ^~ /blogs.dir { | |
internal; | |
alias /var/www/example.com/public_html/htdocs/wp-content/blogs.dir; | |
access_log off; log_not_found off; expires max; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#File: /etc/nginx/sites-enabled/example.com; | |
map $http_host $blogid { | |
default -999; | |
#Ref: http://wordpress.org/extend/plugins/nginx-helper/ | |
include /var/www/example.com/public_html/wp-content/uploads/nginx-helper/map.conf; | |
} | |
server { | |
listen 80; | |
listen [::]:80; | |
listen 443 ssl; | |
listen [::]:443 ssl; | |
#ssl on; | |
ssl_certificate /etc/ssl/localcert/example.com.crt; | |
ssl_certificate_key /etc/ssl/localcert/example.com.key; | |
access_log /var/logs/access/example.com.log; | |
error_log /var/logs/error/ferguson.pw.log; | |
root /var/www/example.com/public_html; | |
server_name example.com alice.example.com bob.example.com charlie.example.com david.example.com edward.example.com | |
include /etc/nginx/sites-available/commonWP.example.pw; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#File: /var/www/example.com/public_html/wp-content/uploads/nginx-helper/map.conf | |
example.com 1; | |
alice.example.com 2; | |
bob.example.com 3; | |
charlie.example.com 4; | |
david.example.com 5; | |
edward.example.com 6; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment