Solved

Setting up restrictions on Apache

Posted on 2011-03-13
5
367 Views
Last Modified: 2012-05-11
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
Comment
Question by:tuxracer
  • 3
  • 2
5 Comments
 
LVL 10

Expert Comment

by:aboo_s
ID: 35121017
You can create .htaccess per directory and it will affect only current directory and what is beneath it.
0
 

Author Comment

by:tuxracer
ID: 35121045
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
 
LVL 10

Accepted Solution

by:
aboo_s earned 125 total points
ID: 35121064
Order deny,allow
deny from all
Allow from 10.0.0.
0
 

Author Closing Comment

by:tuxracer
ID: 35127212
Thank you so much!!!!

Works like a charm...

:)
0
 
LVL 10

Expert Comment

by:aboo_s
ID: 35127619
You are very welcome, glad I could have helped!
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now