Restrict Apache access to your local computer

Posted . Visible to the public.

When you are using Apache for development, it still accepts connections from everyone in the same network as you.

In order to only allow requests to your Apache coming from your local computer, edit your /etc/apache2/ports.conf so all Listen directives point to 127.0.0.1:

Listen 127.0.0.1:80
<IfModule mod_ssl.c>
    Listen 127.0.0.1:443
</IfModule>

After the change stop and start your Apache and check with netstat that Apache no longer listens to 0.0.0.0:

sudo /etc/init.d/apache2 stop
sudo /etc/init.d/apache2 start
sudo netstat -napl | grep apache
Henning Koch
Last edit
Keywords
security, passenger
License
Source code in this card is licensed under the MIT License.
Posted by Henning Koch to makandra dev (2011-01-23 01:37)