add nginx config to dotfiles

This commit is contained in:
Nick Nisi
2015-01-16 17:24:57 -06:00
parent e8220bab1b
commit 0b83506023
2 changed files with 154 additions and 0 deletions

34
nginx/sites-available/code.dev Executable file
View File

@@ -0,0 +1,34 @@
server {
listen 80;
server_name app localhost .dev;
# the location of our projects directory
set $basepath "/Users/nicknisi/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.html) {
set $rootpath $domain;
}
root $basepath/$rootpath;
location / {
# enable index view of the directory
autoindex on;
# a 405 is thrown when posting to a static file. this corrects it
error_page 405 = $uri;
}
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}