Skip to content

Instantly share code, notes, and snippets.

@trepmal
Created December 18, 2015 00:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trepmal/a2e5eb2a88d49c39eb65 to your computer and use it in GitHub Desktop.
Save trepmal/a2e5eb2a88d49c39eb65 to your computer and use it in GitHub Desktop.
# map block must be outside the server{} block
map $host $productionurl {
default mainsite.com;
## uncomment for multisite
# subsite.dev subsite.com;
# subsite2.dev subsite2.com;
# subsite3.dev subsite3.com;
}
server {
# . . .
location ~* \.(png|jpg|jpeg|gif|ico|mp3|mov|tif|tiff|swf)$ {
try_files $uri $uri/ @production;
}
location @production {
resolver 8.8.8.8;
proxy_pass http://$productionurl/$uri;
}
# . . .
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment