Mobile app version of vmapp.org
Login or Join
Heady270

: Apache block all requests but my IP using the config file I'm looking to upload the website that I've developed locally to my remote web server. However, so that I can test that the upload

@Heady270

Posted in: #Apache #Security

I'm looking to upload the website that I've developed locally to my remote web server. However, so that I can test that the upload has gone fine and that all the basic security is in place, I want to use the Apache configuration file (/etc/apache2/apache2.conf) to block every thing except the IP address from my internet connection. (I'm using Debian 7.6 and Apache 2.2.22)

Can anyone tell me why the following code isn't working? It's allowing everything access to the site.

I have a test directory that I just play with that I've currently blocked all on. I'll change test to a range of includes folders that I don't want anyone to have access to.

Additionally, is it not possible to list the directories by their path relative to the root web directory with the line: DocumentRoot /var/www?

<Directory />
Options Indexes FollowSymLinks
AllowOverride None
</Directory>

<Directory "/var/www">
Options -Indexes +FollowSymLinks +Includes
AllowOverride None
Order allow,deny
deny from all
allow from *{MY IP ADDRESS}*
</Directory>

<Directory "/var/www/test">
Order allow,deny
Deny from all
</Directory>

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Heady270

1 Comments

Sorted by latest first Latest Oldest Best

 

@Ogunnowo487

Can anyone tell me why the following code isn't working?


By "not working", I assume it is blocking everyone, including yourself? You need to remove the deny from all directive from that code block. This is overriding your allow from... line. All requests which don't match your IP address are implicitly deny'd, because of the Order directive.

The Directory directive takes a full system path.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme