Securing Directories and Files with Apache

Discussion in 'Apache' started by dreamality, Jan 12, 2011.

  1. #1
    I'm running into a problem with protecting a virtualhost. Below is the code I use:

    
    <VirtualHost {some_ip}:80>
        SuexecUserGroup    {some_user} {some_group}
        ServerAdmin "{some_email}"
        ServerName {some_domain}
        ServerAlias www.{some_domain}
        DocumentRoot "{some_doc_root}"
        <Directory "{some_doc_root}">
            Options +Indexes +FollowSymLinks
            Order Deny,Allow
            Deny from all
            <FilesMatch ".*.(php|html|css|js|ico|PHP|HTML|CSS|JS|ICO)$" >
                Order Allow,Deny
                Allow from all
            </FilesMatch>
        </Directory>
    </VirtualHost>
    
    Code (markup):
    My objective is to:
    1. Prevent ALL access
    2. Allow access to certain files

    The problem with the above code is that when I hit http://www.{some_domain}/index.php, everything works fine but http://www.{some_domain}/ gets a Forbidden message.

    Any tips on getting this resolved?

    Thanks in advance.
    -running Apache 2
     
    dreamality, Jan 12, 2011 IP
  2. zacharooni

    zacharooni Well-Known Member

    Messages:
    346
    Likes Received:
    20
    Best Answers:
    4
    Trophy Points:
    120
    #2
    I think you maybe forgot to escape the "." with \.
     
    zacharooni, Jan 13, 2011 IP
  3. dreamality

    dreamality Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Didn't work. Any other suggestion?

    Thanks.
     
    dreamality, Jan 13, 2011 IP