Hi,
First I really love what your team is doing (trying really hard to embrace it).
My set-up is:
- WordPress networking + subdomains
- Nginx Helper Plugin
- Redis
While setting up domain mapping using the option “Enable Nginx Map.” domain names did not resolve. I checked to make sure the file was created, and added the map {}
to my conf file (above the server {}
not sure if that is the right location). Restarted nginx, nothing.
What I did to resolve the issue was to set my server_name
to *.com
, is that bad? If so why? If not why use the map.conf
file when *.com
will work and is less options.
My final conf file is, and is located in /etc/nginx/sites-available/foo.com
fastcgi_cache_path /home/foo/bar.com/cache levels=1:2 keys_zone=WORDPRESS:100m inactive=60m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
# map $http_host $blogid {
# default 1;
# include /home/foo/bar.com/public/wp-content/uploads/nginx-helper/map.conf;
# }
server {
# for domain mapping
# This is already set in the main nginx.conf
# listen 80 default_server;
server_name bar.com *.bar.com *.com;
# For domain mapping
server_name_in_redirect off;
access_log /home/foo/bar.com/logs/access.log;
error_log /home/foo/bar.com/logs/error.log;
root /home/foo/bar.com/public/;
index index.php;
## Cache
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-.*.php|/feed/|index.php|sitemap(_index)?.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;
}
## End Cache
# Allow for WP subdirectories to work
if (!-e $request_filename) {
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
rewrite ^(/[^/]+)?(/wp-.*) $2 last;
rewrite ^(/[^/]+)?(/.*\.php) $2 last;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
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";
}
}
P.S., I’m still “playing around” with your ee product, I’m 50/50 with it atm.