Apache
  Home arrow Apache arrow Page 2 - An Introduction to Security Measures i...
Dev Shed Forums 
Administration  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
APACHE

An Introduction to Security Measures in Apache 2.2
By: Dan Wellman
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 3
    2007-01-30

    Table of Contents:
  • An Introduction to Security Measures in Apache 2.2
  • Configure it right
  • Password
  • More on Passwords

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
     
    ADVERTISEMENT

    Dell PowerEdge Servers

    An Introduction to Security Measures in Apache 2.2 - Configure it right
    (Page 2 of 4 )

    The following directives can be placed either into the main Apache configuration file, the httpd.conf file, or into individual .htaccess files (or distributed configuration files).  However, it is recommended that they be placed into the configuration file rather than using the .htaccess method.  The reason for this is for both performance and security. Apache will look in every directory for .htaccess files every time a document is requested if it is configured to allow them. 

    The security aspect is less of a problem when used in the scenario of this tutorial because you probably aren't an ISP with lots of users wanting to configure their own directories, however, a misconfiguration of the <FilesMatch "^.ht"> directive will allow remote users to view the files in a browser.  Apache themselves state that .htaccess files should only ever be used when you don't have access to the main server configuration file, so heed their advice and save yourself problems if you are ever in a position of making these kinds of configuration decisions on a live, publicly accessed web server.

    The following statements can happily reside in any <Directory> section of your configuration file.  The folder I use to serve documents from on my own machine is C:www but you could just as easily share and protect your music folder.

    <Directory "C:/Documents & Settings/username/My Documents/My Music" >

    The following directives will cause Apache to require a valid username and password to be entered when requesting any document from the www directory:

    <Directory "C:/www">
     
    AuthUserFile "C:/hidden/passwords.txt"
     
    AuthType basic
     
    AuthName "Restricted Area"
     
    Require valid-user
    </Directory>

    Firstly, we specify the path to the file that contains the usernames and passwords.  Next we declare which type of authentication we are using.  The AuthName directive allows us to set the text that appears in the header of the credentials prompt and also allows us to set a realm where an already authenticated visitor can request other protected directories (provided they also have AuthName "Restricted Area" in their respective <directory> section) without needing to enter the password again. 

    Finally, the Require directive states that any authenticated visitors may access the directory. Alternatively, you could specify individual users that are allowed access.  There are other directives that can be used, such as the Satisfy statement, but in this situation, nothing else is required.

    More Apache Articles
    More By Dan Wellman


       · Hi Everyone, I found this part of the Apache setup very interesting and logical...
       · You should also have something like this under httpd.conf or .htaccess to make sure...
       · When using PHP5 & Apache for digest authentication, I found that I had to change the...
     

       

    APACHE ARTICLES

    - Putting Apache in Jail
    - Containing Intrusions in Apache
    - Server Limits for Apache Security
    - Setting Permissions in Apache
    - Installing Apache
    - Apache Installation and Configuration
    - Apache Tapestry and Custom Components: DateI...
    - Tapestry and AJAX: Autocompleter and InlineE...
    - PropertySelection and IPropertySelectionMode...
    - The DatePicker and Shell Components of Apach...
    - Apache Tapestry: ASO and More Components
    - Apache Tapestry and DirectLink, IoC and DI
    - Making a CelebrityCollector with Apache Tape...
    - Apache Tapestry and Listener Methods, Condit...
    - The Properties of Tapestry Pages

     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway