Last active
August 29, 2015 14:16
-
-
Save florentdestremau/61ea35d0d27728f759da to your computer and use it in GitHub Desktop.
Enable apache auth for websites under construction
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
First of all, you need uapache2-utils tools. | |
sudo apt-get install apache2-utils | |
Then you add this in your virtualhost in your <Directory> tag : | |
#Require all granted | |
# you need to comment this line above to require a valid-user | |
AuthName "This website is not ready to go public !" | |
AuthType Basic | |
AuthUserFile /var/www/.htpasswd | |
require valid-user | |
The `AuthUserFile` can be created anywhere, just has to be readable, i find www/ apropriate (it's not a security matter, just privacy). | |
Then you create your user: | |
htpasswd -c /usr/local/etc/httpd/users name-of-your-user | |
You will be prompted the password | |
Finally | |
sudo service apache2 restart | |
Not sure if restart is needed instead of reload but under developement who cares :3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment