Skip to content

Instantly share code, notes, and snippets.

@thomasgriffin
thomasgriffin / gist:4733283
Created February 7, 2013 19:05
Map subdomains to URLs in nginx with WordPress.
server {
listen 80;
listen 443 ssl;
server_name ~^(?<user>[a-zA-Z0-9-]+)\.example\.com$;
location / {
resolver 8.8.8.8;
rewrite ^([^.]*[^/])$ $1/ permanent;
proxy_pass_header Set-Cookie;
proxy_pass $scheme://example.com/user/$user$request_uri;