Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Apache folder restrictions only for a subnet?

Posted on 2012-08-24
Medium Priority
Last Modified: 2012-08-26

I've got a Linux server that has the IP

My virtualhost has the following configuration:

<VirtualHost *:80>
    ServerAdmin webm@server.example.com
    DocumentRoot /var/www/virtual
    ServerName server.example.com
    ErrorLog logs/server.example.com
    CustomLog logs/server.example.com-access_log common

Under /var/www/virtual I have a directory: /var/www/virtual/billing

 that has a index.html file that I'd like to be available when clients access:


However, this link must be accessible only to clients from network:

When clients from other networks are trying to access /var/www/virtual/billing they shouldn't be able to do so.

Is this achievable?

Question by:g0all
LVL 29

Accepted Solution

Jan Springer earned 1600 total points
ID: 38330651
Within the virtual host <Directory> section:

Order deny,allow
Deny from all
Allow from

Assisted Solution

zunder1990 earned 400 total points
ID: 38330696
If you look at Section 2 "main" server config of httpd.conf for the line<Directory "/var/www/html"> that will tell you how to use the Directory option. I have added my allow access after the </directory>. This is what mine looks like

<Directory /var/www/html/administrator/>
Order allow,deny
Allow from
Allow from 127
Allow from
Allow from

Open in new window


Author Closing Comment

ID: 38331233
Thank you!
LVL 13

Expert Comment

ID: 38334303
.htaccess is also a good solution

Featured Post

Evaluating UTMs? Here's what you need to know!

Evaluating a UTM appliance and vendor can prove to be an overwhelming exercise.  How can you make sure that you're getting the security that your organization needs without breaking the bank? Check out our UTM Buyer's Guide for more information on what you should be looking for!

Question has a verified solution.

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

​Being a Managed Services Provider (MSP) has presented you  with challenges in the past— and by meeting those challenges you’ve reaped the rewards of success.  In 2014, challenges and rewards remain; but as the Internet and business environment evol…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
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 Month12 days, 9 hours left to enroll

579 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