Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 09-28-2012, 11:37 AM   #1
LQ Newbie
Registered: May 2006
Posts: 13

Rep: Reputation: 0
Question Restricting access to Apache directories


I have LAMP running on Ubuntu 12.04. Besides this I also have installed in subdirectories under /var/www/ webmin, ossec, gallery, etc.

I have a no-ip domain so my default webpage is served from

I want to be able to prevent access to or except from my LAN 192.168.0.x but have access to from anywhere.

What is the easiest (simple) and least time consuming way to do this please?

Old 09-28-2012, 05:24 PM   #2
Registered: Aug 2006
Location: Canada
Distribution: Debian, Slackware
Posts: 106

Rep: Reputation: 28
You are going to need to add some security.

You have several options. You can use htpasswd ,and put a username/password prompt in front of those directories,
or you can do directory security.

Directory security would look something like this:

<Directory /var/www/webmin/>
Order, Deny, Allow
Deny from All
Allow from 192.168.0.

If you want to use username/password protection so that you can still access these directories from the outside,
then I would add htpasswd:

<Directory /var/www/webmin/>
AllowOverride AuthConfig
AuthType Digest
AuthName "something_goes_here"
AuthDigestProvider file
AuthUserFile /etc/apache2/htaccess/digest_file_name
Require valid-user
Order, Deny, Allow
Deny from All
Allow from 192.168.0.
Satisfy Any

I use the 2nd option for myself. It allows passowrd-less access from my local lan,
but when I connect from outside, it requires a username/password.
1 members found this post helpful.


apache, ubuntu

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Can I use Apache to access encrypted directories? norwichnick Linux - Security 10 06-27-2012 02:53 AM
Restricting 'du' to child directories only? daweefolk Linux - General 1 02-15-2011 01:31 PM
Restricting users to two directories Centos 5.3 thebomb Linux - Server 1 02-16-2010 01:01 AM
Apache: Adding access to other non DocumentRoot directories pgbackup Linux - Server 1 03-24-2009 12:26 PM
Can't access non-server-root directories in Apache jenna_h Linux - Networking 13 10-29-2003 06:22 PM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03:24 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration