Controlling Access from Hosts in Ubuntu 8.10

by Mike on November 17, 2008

in Web Server

Open the web browser on your own computer.  Go to “http://www.whatismyip.com”.  Write down the IP address that it returns.  This will provide you with a way to test how access control in Apache works.

Change to the “/etc/apache2/sites-available” directory.  On one of the sites that you have on your web server you will need to create a directory stanza.

Change the second directory stanza to read as follows:

<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
deny from your_IP_address

# This directive allows us to have apache2′s default start page
# in /apache2-default/, but still have / go to the right place
# RedirectMatch ^/$ /apache2-default/
</Directory>
Be sure to replace your_IP_Address with the actual IP that you discovered before.

Save the file, and reload the configuration.

sudo /etc/init.d/apache2 force-reload

With the browser of your own computer, try to access the website on the practice server.   Were you able to get in?

Previous post:

Next post: