1

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>
1

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.

  • Sorry I should have said it's not denying anything. I'm being allowed access from all IP addresses. – hojkoff Oct 12 '14 at 16:22
  • Ah! Sorry to ask the obvious, have you restarted Apache after making changes to your main config file? – MrWhite Oct 12 '14 at 16:49
  • Yup, still not working. Is there anything actually wrong with the code? – hojkoff Oct 12 '14 at 17:07
  • Not AFAIK, apart from as mentioned in my answer (it should be blocking everything as far as I can tell). Assume the directory-path is correct? Assuming your Allow line is of the form: Allow from 123.123.123.123? A little odd perhaps that you enable Indexes for /, but later take it away -Indexes - but that is academic. – MrWhite Oct 12 '14 at 17:53
  • The directory path is correct. Oddly the /var/www/test directory is blocked. So I can't see why /var/www isn't as it's essentially the same code. – hojkoff Oct 13 '14 at 16:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.