O'Reilly logo

Apache: The Definitive Guide, Second Edition by Peter Laurie, Ben Laurie

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

5.8. Anonymous Access

It often happens that even though you have passwords controlling the access to certain things on your site, you also want to allow guests to come and sample the site's joys—probably a reduced set of joys, mediated by the username passed on by the client's browser. The Apache module mod_auth_anon.c allows you to do just this. It should be compiled in automatically—check by looking at Configuration. If it wasn't compiled in, you may get this unnerving error message:

            Invalid command Anonymous

when you try to exercise the Anonymous directive. The Config file, in ... /site.anon/conf/httpd.conf, is as follows:

User webuser Group webgroup ServerName www.butterthlies.com IdentityCheckon NameVirtualHost 192.168.123.2 <VirtualHost www.butterthlies.com> #CookieLog logs/cookies ServerAdmin sales@butterthlies.com DocumentRoot /usr/www/site.anon/htdocs/customers ServerName www.butterthlies.com ErrorLog /usr/www/site.anon/logs/customers/error_log TransferLog /usr/www/site.anon/logs/access_log ScriptAlias /cgi-bin /usr/www/cgi-bin </VirtualHost> <VirtualHost sales.butterthlies.com> CookieLog logs/cookies ServerAdmin sales_mgr@butterthlies.com DocumentRoot /usr/www/site.anon/htdocs/salesmen ServerName sales.butterthlies.com ErrorLog /usr/www/site.anon/logs/error_log TransferLog /usr/www/site.anon/logs/salesmen/access_log ScriptAlias /cgi-bin /usr/www/cgi-bin <Directory /usr/www/site.anon/htdocs/salesmen> AuthType Basic AuthName darkness AuthUserFile /usr/www/ok_users/sales ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required