Administration
  Home arrow Administration arrow Page 2 - Getting More Out Of Apache (Part 2)
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 
IBM Rational Software Development Conference
 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? 
ADMINISTRATION

Getting More Out Of Apache (Part 2)
By: icarus, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2001-01-23

    Table of Contents:
  • Getting More Out Of Apache (Part 2)
  • Eyes Only
  • Identity Check
  • Grouping Things Together
  • Timmmmmmbbbbberrrr!
  • When Things Go Wrong
  • Just Rewrite It!
  • Putting It Into Practice

  • 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
     
     
    FaxWave - Free Trial.
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Getting More Out Of Apache (Part 2) - Eyes Only
    (Page 2 of 8 )

    Security has always been a prime concern so far as the Internet isconcerned; barely a week passes without media reports of security breachesat one Web site or another. If this is something you're concerned about(and you should be), you can set up Apache to protect confidentialinformation on your Web site with a simple form of user authentication.

    Apache's user authentication mechanism is based on the traditionalusername-password challenge mechanism. When the Web server receives arequest for a directory or file that it knows to be a protectedresource (aka "realm"), it responds by sending the client browser anauthentication challenge. It is only after receiving a valid username andpassword back from the client browser that access is granted to the realm.

    The concept is simple, and it works well; however, implementing it requiresa little more work.

    The simplest way to add protection to a specific directory is via the".htaccess" file. In order to see how this works, create a file named".htaccess" in the directory you wish to protect. Open the file in yourfavourite text editor and add the following lines to it:

    # members table AuthType Basic AuthName "Top-Secret Information" AuthUserFile /usr/local/apache/auth/mfre/users require valid-user
    The first two directives are pretty standard - the AuthType directivespecifies the type of authentication (usually "Basic", although there isalso a "Digest" type of authentication), while the AuthName directivespecifies a name or description for the resource. This description willappear in the client browser when the user attempts to access the protecteddirectory, so you should choose something descriptive.

    The AuthUserFile directive specifies the location for the file containing alist of authorized users, together with their passwords. This file should*always* be placed outside the Web server root, in an area notaccessible to a browser; if this is not done, anyone can download the fileand view the information in it.

    Finally, the "require valid-user" statement specifies the kinds of usersthat have access to this directory - in this case, it means that all validusers (read: users listed in the authorization file) have the ability toview the contents of the directory. You could further restrict the numberof people allowed access by specifying user or group names - for example,the statement "require user joe beth" would only allow users "joe" and"beth" access to this area.

    You should be aware, however, that the server will only read the".htaccess" file if it is configured to do so. In order to confirm this,open up your main Apache configuration file, "httpd.conf", and look for the tags which reference your Web server root. These tags shouldlook something like this:

    ...stuff... AllowOverride All ...stuff...
    The

    AllowOverride All
    directive tells the server that global configuration parameters can beoverridden by local ones - the parameters in the per-directory ".htaccess"file.

    More Administration Articles
    More By icarus, (c) Melonfire


     

       

    ADMINISTRATION ARTICLES

    - Configuring Load-Balanced Clusters
    - Load-Balanced Clusters
    - UNIX Time Format Demystified
    - Making Changes in the CVS
    - Building Your First CVS Repository
    - CVS Quickstart Guide
    - Authorizing Users in Samba
    - Handling User Accounts in Samba
    - Authentication in Samba
    - Accounts, Authentication, and Authorization
    - Advanced Concepts on Dealing with Files and ...
    - Dealing with Files and Filesystems
    - More Hacks for the User Environment in BSD
    - Personalizing the User Environment in BSD
    - Customizing the User Environment in BSD

     
    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 2 hosted by Hostway