Skip to content

Instantly share code, notes, and snippets.

@zaiste
Last active December 15, 2015 14:49
Show Gist options
  • Save zaiste/5277618 to your computer and use it in GitHub Desktop.
Save zaiste/5277618 to your computer and use it in GitHub Desktop.
...
include sites-enabled/*.dev;
server {
listen 80;
server_name app localhost .dev;
set $basepath "/Users/zaiste/code";
set $domain $host;
if ($domain ~ "^(.*)\.dev$") {
set $domain $1;
}
set $rootpath "${domain}";
if (-d $basepath/$domain/public) {
set $rootpath "${domain}/public";
}
if (-f $basepath/$domain/index.php) {
set $rootpath $domain;
}
if (-f $basepath/$domain/index.html) {
set $rootpath $domain;
}
root $basepath/$rootpath;
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment