Apache access control the Agaric way

Key words and phrases: 
require password authentication Apache authorization limiting access to test server control who can view development sites
Description & Info: 

Clients don't like their test site competing with their live, production site for Google results. Therefore, we have put our entire set of test sites behind a pop-up requiring basic Apache authentication.

For ongoing maintenance — adding new people to access the test environment behind the authorization wall — the operative command is:

sudo htpasswd /etc/apache2/passwd/passwords sam

Where sam is replaced with whatever username you want the next user added to have.

The setup instructions follow below.

Roughly following the instructions here:
http://httpd.apache.org/docs/2.2/howto/auth.html

sudo mkdir /etc/apache2/passwd

sudo htpasswd -c /etc/apache2/passwd/passwords dan
New password:
Re-type new password:
Adding password for user dan

sudo htpasswd /etc/apache2/passwd/passwords benjamin
New password:
Re-type new password:
Adding password for user benjamin

sudo vi /etc/apache2/httpd.conf

<Directory /sites>
  AuthType Basic
  AuthName "Agaric Test Server"
  AuthBasicProvider file
  AuthUserFile /etc/apache2/passwd/passwords
  Require valid-user
</Directory>

sudo /etc/init.d/apache2 reload

That works for all subdirectories of /sites thankfully

Post new comment
The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote> <h1> <h2> <h3> <h4> <h5> <h6> <small> <pre> <strike> <sub> <sup>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.