Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a file on my apache server which i do not want the public to access.

I have a couple of IP addresses that will be needing the file, hence i want to grant them access to the file.

How can i go about it?

Thanks

share|improve this question

migrated from stackoverflow.com Jun 23 '11 at 6:29

This question came from our site for professional and enthusiast programmers.

2 Answers 2

If you want to restrict access to just a single file say /var/www/filename.ext:

<Directory /var/www/>
  <Files filename.ext>
    Order allow,deny
    Allow from 192.168.1.1 192.168.10.12 192.168.1.15
  </Files>
</Directory> 
share|improve this answer

mod_authz_host? There are a few way to specify, check out the link it has a few examples.

Order Deny,Allow
Deny from all
Allow from 10.1.2.3
Allow from 192.168.1.104 192.168.1.205 
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.