[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Setting up restrictions on Apache

Posted on 2011-03-13
5
Medium Priority
?
376 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 500 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses

656 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