[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Setting up restrictions on Apache

Posted on 2011-03-13
5
Medium Priority
?
377 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 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses
Course of the Month20 days, 4 hours left to enroll

873 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