Sunday, December 22, 2024

Installing the Apache Web Server for Windows and Tweaking it

Share

I’m not sure if it is a rumor or a reality, but they say 55%-60% web sites on the Net are run on Apache Web Servers.

First, follow these simple steps to get the Server on to your computer:

1. There is a cool Apache site from where you can download a pre-compiled, ready to install Windows binary file. The URL is http://www.apache/org/dist/binaries/win32/.

2. Run the file from where you have downloaded it.

3. Specify the installation path. By default it should be c:program filesapache groupapache”, but if you are the choosy type, you can specify your own path.

4. The installation wizard will ask for the name that will appear in the Start menu. The default is “Apache Web Server”.

5. The installation wizard will ask for the installation type: typical, minimum or custom. The “typical” install is, well, typical, so go ahead and choose that one.

Now you get to sit back and watch as the installation sequence runs through its paces. The installation wizard will tell you when it’s finished, and then it will ask if you want to read the README file. Take a quick look at it and click Finish to end the process.

During the installation process, a default set of configuration files will be placed in the “conf” directory, which lives within the installation directory (i.e. “C:Program FilesApache GroupApacheconf”). If you make a few minor changes to the httpd.conf file (the master Apache configuration file), you can start Apache and prove that it’s working properly.

NOTE: Save the default copy of httpd.conf properly if your are tweaking it for the first time. You might end up creating a mess and then you might have to restore the default status.

In your text editor of choice, open httpd.conf and find a line starting with:

ServerAdmin

Modify this entry and provide your own information, such as:

ServerAdmin yourname@yourdomain@schmo.com

Next, find a line starting with:

#ServerName

Take away the “#” and change this entry to real values, such as:

ServerName localhost

If you have a real machine name, like mybox.yourdomain.com, go ahead and use it instead of localhost:

ServerName mybox.yourdomain.com

With those changes made, save the file and follow along to try to start Apache. If you’re on Windows NT and you want to run Apache as a service:

1. Select “Install Apache as Service (NT only)” from your Start menu.

2. Start the service named “Apache” by opening the Services window in the Control Panel, selecting “Apache,” and clicking the “Start” button.

Apache will now continue to run in the background, and will automatically start whenever your machine starts.

If you’re not running NT and need to start Apache on your own:

1. Select “Start Apache” or “Start Apache as a Console App” from the Apache folder in the Start menu. A console window will open and Apache will run. Keep this window open.

And that’s it. Really.

TIP: If you start Apache from the shortcut, and you see the window flash and then disappear, something has gone seriously wrong. Nine times out of 10, this means you have a typo in your httpd.conf. To keep the window open and see the actual error message, open a DOS console, navigate to the Apache installation directory, go into the bin directory and type apache.exe to start the server. The window will stay open, you’ll see the message, and you’ll know what to fix. Fix it, save httpd.conf, restart Apache.

You should never have to reboot your machine to start and stop Apache. If you do, that’s a Windows issue.

After starting Apache, open your Web browser and type “http://localhost/” in the location bar to view the default installation page and verify that it’s working. If you used a ServerName other than localhost, type that name in the location bar instead.

If you want to store your web pages at other than the default location (.apachehtdocs), go to the section DocumentRoot, and specify the path.

Again, if you want to use Server Side Includes in your pages (and which you can’t check if you run the pages without a server), you have to carry out the following changes to your httpd.conf file:

1. go to

2. Include the line Options Includes

3. go to DirectoryIndex and add index.shtml or default.shtml or home.shtml, if they are not already in the list.

4. also add the following lines somewhere

AddType text/html .shtml
AddHandler server-parsed .shtml

And now you can run Server Side Includes.

When working with HTML pages, the extension SHTML is given to those pages that have server side includes.

You can also specify what extension of files should be the default extension. For instance, if your server only understands index.HTM files and not index.HTML files, or, default.HTML files but not index.HTML files, simply typing www.yourdomain.com will generate a “page not found error” if the page with particular extension is not present. You can set your default extension for the root directory in the following manner:

1. Find the line:

DirectoryIndex

2. Whatever extension you want to setup as the default extensions, you can mention them here.

DirectoryIndex index.html index.htm index.shtml default.html index.php

Separate all the names with a space.

Amrit Hallan is a freelance copywriter,
and a website content writer. He also dabbles
with PHP and HTML. For more tips and tricks in
PHP, JavaScripting, XML, CSS designing and
HTML, visit his blog at
http://www.aboutwebdesigning.com

Table of contents

Read more

Local News