Apache folder restrictions only for a subnet?

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

I've got a Linux server that has the IP

My virtualhost has the following configuration:

<VirtualHost *:80>
    DocumentRoot /var/www/virtual
    ErrorLog logs/
    CustomLog logs/ 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 2

    Expert Comment

    LVL 28

    Accepted Solution

    Within the virtual host <Directory> section:

    Order deny,allow
    Deny from all
    Allow from
    LVL 2

    Assisted Solution

    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

    LVL 1

    Author Closing Comment

    Thank you!
    LVL 13

    Expert Comment

    .htaccess is also a good solution

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
    In my business, I use the LTS (Long Term Support) versions of Linux. My workstations do real work, and so I rarely have the patience to deal with silly problems caused by an upgraded kernel that had experimental software on it to begin with from a r…
    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…
    Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

    737 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

    20 Experts available now in Live!

    Get 1:1 Help Now