• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 379
  • Last Modified:

Setting up restrictions on Apache

Hi Group

I was wondering if there is a way to restrict access to a particular directory using apache. I know there is however I was using the <Directory> option shipped in apache but it seems like when this is enable it affects all my sites.

for example if I wanted restrict access to a particular virtual host -

So for example I have a bunch of files in /var/www/mydir and I wanted to restrict access to only localhost.

How can I accomplish this without affecting any other operations of the webserver?

I am probably missing something in my config somewhere thats making the change global or something.

Any suggestions would be highly appreciated.

Thanks
0
tuxracer
Asked:
tuxracer
  • 3
  • 2
1 Solution
 
aboo_sCommented:
You can create .htaccess per directory and it will affect only current directory and what is beneath it.
0
 
tuxracerAuthor Commented:
Hi aboo_s

Thank for your feedback. I thought that .htaccess was for user access only. Suppose I wanted a particular ip range to only access that particular directory. How would I achieve that?

I thought we could use something link this :

<Directory /var/www/mydir/>
Order allow,deny
Allow from 10.0.0.
</Directory>

When I try this config, only getting the welcome page on all my websites.

Is there something I need to change in the order?

Thanks
0
 
aboo_sCommented:
Order deny,allow
deny from all
Allow from 10.0.0.
0
 
tuxracerAuthor Commented:
Thank you so much!!!!

Works like a charm...

:)
0
 
aboo_sCommented:
You are very welcome, glad I could have helped!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now