Skip to content

Instantly share code, notes, and snippets.

@Gems
Last active August 29, 2015 14:25
Show Gist options
  • Save Gems/fa8a40d6cc6d212ab586 to your computer and use it in GitHub Desktop.
Save Gems/fa8a40d6cc6d212ab586 to your computer and use it in GitHub Desktop.
Development environment
server {
listen 80;
server_name ~^(?<domain>.+)$;
set $htdocs "/usr/local/var/www/$domain/";
root $htdocs;
index index.html;
set $auth "off";
if (-f $htdocs/.htpasswd) {
set $auth "Restricted";
}
auth_basic $auth;
auth_basic_user_file $htdocs/.htpasswd;
location ~(?<url>.+)\/$ {
try_files $url $url/ $url.html =404;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment