Apache: password from certain IP addresses

How to prompt for a password on apache from certain ip addresses.

Just for next time I need it:

Open up the default site, in the main <Directory /var/www> block do something like this:

<Directory /var/www/>
                Options -Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                AuthUserFile /etc/apache2/htpasswords
                AuthName "Enter password"
                AuthType Basic
                Require valid-user
                Allow from 192.168.1
                Satisfy Any



Leave a Reply

Your email address will not be published.