feature | daily | high gear | we::blog | contact      
 
Search
Feature / 16 Nov 2000 / Apache Personal Web Server under Windows 98
Web Search
Anyone can submit a news item, but only members can comment on them! New users, sign up here.
 
  danchan Login  
  Nickname  
   
  Password  
   
  Remember  
   

New openlog - the unbearable lightness of blog - plus free weblogging with comments, easy syndication and no ads!

Get [danchan] for your PDA!

Every daily news item!

10 latest comments

  Archive  
  2001 December
2001 November
2001 October
2001 September
2001 August
2001 July
2001 June
2001 May
2001 April
2001 March
2001 February
2001 January
2000 December
2000 November
2000 October
2000 September
2000 August
2000 July
2000 June
 

How to setup Apache as your personal web server under Windows

The most popular web server in the world is Apache. Between Perl, MySQL and Apache (all three of which are open-source and free) you can set up almost any site you can imagine. Most web hosting services use Apache and if you want to take advantage of the administrative power of Apache on your site, you'll have to install Apache for Windows to access and test your site locally without making any changes to your cgi scripts.

That's right, the advanced user tosses out Microsoft's Personal Web Server and uses Apache instead. The Apache Software Foundation warns that the Win32 version of its server software is not as stable or secure as its Unix version but for purposes of testing a web site locally, it's fine.

Installation is easy. Download the latest binary for Win32 and execute it. It'll create an Apache Group under your Program Files. Choose Programs > Apache Web Server > Management > Edit Configuration. This opens a file called httpd.conf which is a text file that holds all the important server directives. You customize the basic functionality of Apache by editing this file.

Most of httpd.conf is self-explanatory. There are plenty of comments, but there are a few stumbling blocks, so I'll guide you through it.

First thing to do is set up your document root directory. You must use forward-slashes instead of the normal back-slash under Windows. The examples below assume the standard Dreamweaver setup. Your document root and other directories may be different.

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
# replace
# DocumentRoot "C:/Program Files/Apache Group/Apache/htdocs"
# with
DocumentRoot "C:/Sites/your_site"

...

#
# This should be changed to whatever you set DocumentRoot to.
#
# replace
# <directory "C:/Program Files/Apache Group/htdocs">
# with
<directory "C:/Sites/your_site">

Stumbling Block #1: If you want to use CGI scripts and SSI outside of your designated script directory, you have to add ExecCGI and Includes to this Options line. This is not apparent the first time you're trying to figure out the file.

#
# This may also be "None", "All", or any combination of "Indexes",
# "Includes", "FollowSymLinks", "ExecCGI", or "MultiViews".
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
    Options Indexes FollowSymLinks MultiViews ExecCGI Includes

If you want to use index.shtml (SSI) as the default document of the directory.

#
# DirectoryIndex: Name of the file or files to use as a pre-written HTML
# directory index.  Separate multiple entries with spaces.
#
<ifmodule mod_dir.c>
    DirectoryIndex index.shtml index.html
</ifmodule>

Uncomment the ScriptInterpreterSource line because you'll want to use the registry to determine how to run your CGI scripts.

# uncomment
# ScriptInterpreterSource registry
# to
ScriptInterpreterSource registry

Under the Alias section, add an alias for /manual/ so that you can still reference the local offline docs.

#
# Aliases: Add here as many aliases as you need (with no limit). 
# The format is Alias fakename realname
#
<ifmodule mod_alias.c>

...

# ADD THESE LINES SO THAT YOU CAN STILL READ THE APACHE
# DOCUMENTATION AFTER CHANGING YOUR DOCUMENT ROOT DIRECTORY
Alias /manual/ "C:/Program Files/Apache Group/Apache/htdocs/manual/"
   <directory "C:/Program Files/Apache Group/htdocs/manual">
       Options Indexes MultiViews
       AllowOverride None
       Order allow,deny
       Allow from all
   </directory>
# END OF LINES TO ADD

ScriptAlias defines where your script directory resides. Modify it like you did the document root definition above.

#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the realname directory are treated as applications and
# run by the server when requested rather than as documents sent to 
# the client.
# The same rules about trailing "/" apply to ScriptAlias directives 
# as to Alias.
#
# replace
# ScriptAlias /cgi-bin/ "C:/Program Files/Apache Group/Apache/cgi-bin/"
# with
ScriptAlias /cgi-bin/ "D:/Sites/your_site/cgi-bin/"

#
# "C:/Program Files/Apache Group/Apache/cgi-bin" should be changed to 
# whatever your ScriptAliased CGI directory exists, 
# if you have that configured.
#
# replace
# <directory "C:/Program Files/Apache Group/cgi-bin">
# with
<directory "D:/Sites/your_site/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</directory>

Stumbling Block #2: You can't just uncomment the AddHandler and AddType lines because they specify .cgi and .shtml, when they should leave out the period. You must remove the period.

#
# Document types.
#
<IfModule mod_mime.c>

...

#
# AddHandler allows you to map certain file extensions to "handlers",
# actions unrelated to filetype. These can be either built into 
# the server or added with the Action command (see below)
#
# If you want to use server side includes, or CGI outside
# ScriptAliased directories, uncomment the following lines.
#
# To use CGI scripts:
#
# uncomment and change
# AddHandler cgi-script .cgi
# to
AddHandler cgi-script cgi
  
# add this line if your Perl scripts use a .pl extension
AddHandler cgi-script pl

#
# To use server-parsed HTML files
#
# uncomment and change
# AddType text/html .shtml
# to
AddType text/html shtml
# uncomment and change
# AddHandler server-parsed .shtml
# to
AddHandler server-parsed shtml

That should be it.

The important thing to remember is that for CGI scripts and SSI to work outside of the ScriptAlias directory, you'll have to add ExecCGI and Includes to your Options for that directory. Also, when specifying MIME-types, leave out the period in the extension.

If you're not ready for Apache yet (or need help setting up Perl or MySQL under Windows), read "Your very own personal web server" for information about how to set up the built-in Personal Web Server included with Windows 98 .

1 comment
 
posted by bionicroach on 19 Dec 2000
  0 out of 0 members found this comment interesting.  
 

This is bad ass!

Once again, thanks for the tech article! The setup worked perfectly on my machine and now I am stoked because I'll be saving a truckload of money by not having to pay for a hosting service while I'm still stuck in the learning/testing phase...

     
  DAYPOP  
Searching the Living Web
Daypop indexes news sites and weblogs every day to give you the latest relevant information.

Weblogging

Super-customizable weblogging with comments
Add comments to your web site or create a weblog of your own!

Web Caching
Accelerate your website!
Improve your website's responsiveness by preloading your site content into a user's browser cache.

Recent Features

Macau
Photographs from a trip to Macau on the one-year anniversary of the colony's handover to China

Sony CLIE 760C Review
theVooner reviews Sony's color Palm
theVooner's Christmas 2001 Wishlist
Cool gadgets for Christmas 2001

Ericsson T68 Mobile Phone Review
theVooner reviews Ericsson's color screen T68

Toshiba Libretto L2 Review
theVooner's newest sub-notebook

Alfred Dunhill Carbon Fibre
Space-age materials in theVooner's newest pen

Ericsson T39 Mobile Phone and Bluetooth Headset Review
The Bluetooth Headset is a winner in theVooner's book

Sony MZ5 Cellular Phone Review
theVooner's take on convergent technology in the Sony MZ5 Cellular Phone/ATRAC player

Dell Inspiron 4000 Review
theVooner reviews the Dell Inspiron 4000

Sony DSC-S85 4.1 Megapixel Digital Camera Review
theVooner reviews the newest Sony 4.1 Megapixel Digital Camera

Fujitsu PDS4221 - 42" Plasma Display Review
theVooner reviews his new Fujitsu Plasma TV

Bald Cap
danchan tries out a new look for an afternoon

Sony RM-VZ950T Universal Remote Commander Review
theVooner reviews Sony's Universal Remote Commander

New Yorkers visit Los Angeles
Memorial Day Weekend Reunion in L.A.

NYC and Yale Graduation Trip
My sister graduates from Yale

Sharp LC-15A2 15" LCD TV Review
theVooner reviews Sharp's 15" LCD TV

Casio Wrist Camera Review
danchan reviews the Casio Wrist Camera

Gameboy Advance Review
theVooner reviews the next generation Gameboy

Nokia 8890 Review
theVooner reviews the Nokia 8890

Bang & Olufsen Beocom 6000 Cordless Phone Review
theVooner reviews Bang & Olufsen's stylish cordless phone
Questions? Comments? Send all mail to: dc@danchan.com