Skip to content

Instantly share code, notes, and snippets.

@gdunstone
Created January 9, 2017 02:29
Show Gist options
  • Save gdunstone/c307620ef1eec51b5c90e6c14bebf329 to your computer and use it in GitHub Desktop.
Save gdunstone/c307620ef1eec51b5c90e6c14bebf329 to your computer and use it in GitHub Desktop.
NGINX rule for public_html dir with basic auth
location ~* \~(.*)/(.*$) {
auth_basic "Restricted";
auth_basic_user_file /home/$1/public_html/.htpasswd;
alias /home/$1/public_html/$2;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment