Skip to content

Instantly share code, notes, and snippets.

@sfelde
Created October 12, 2013 15:58
Show Gist options
  • Save sfelde/6951611 to your computer and use it in GitHub Desktop.
Save sfelde/6951611 to your computer and use it in GitHub Desktop.
auth for subdomain
...
if ($host ~ "(beta|alpha).domain.com" ) {
return 555;
}
error_page 555 = @auth;
location @auth {
auth_basic "Restricted";
auth_basic_user_file /home/..../.htpasswd;
try_files $uri @pages;
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment