November 26, 2014
Hot Topics:

Apache Server on Windows

  • March 15, 2000
  • By Rich Bowen
  • Send Email »
  • More Articles »

Service vs. console

Apache on NT can be run in one of two modes - as a service, or as a console application.

Service

An NT service is a process that is started automatically when NT starts up, and runs in the background as long as NT is running. This is roughly the same as the way that Apache runs on a Unix machine, for all practical purposes. If you're going to run Apache on a production server, you need to run it as a service, so that it will start automatically when you boot your system.

There are a few different ways to install Apache as an NT service.

The easiest is to just select the Install Apache as Service (NT only) option in the Apache folder in your start menu. This installs Apache as an NT service called Apache.

If you want to install it with different service name, or to start with a different configuration than the default, you can install the service from the command line with command line options:

apache -i -n "service name"
Installs Apache with the service name service name.
apache -i -n "service name" -f"\httpd\alternative\httpd.conf"
Installs Apache with the service name service name, and it will run with configuration options set in the specified configuration file.

To uninstall the Apache service,

apache -u -n "service name"
You can start and stop the Apache service in a number of ways. There is a services dialog that can be reached from the NT control panel, where you can press start and stop buttons.

You can send signals to the Apache service from the command line with the commands:

apache -n "service name" -k start
apache -n "service name" -k restart
apache -n "service name" -k shutdown
Or, you can use the NT net command.
net start apache
net stop apache
Console

An NT service, as the name suggests, runs on NT. Win95 and Win98 don't have this sort of thing. Thus, Apache has to run as a console application on Win9x. That means that you open a DOS window and invoke the Apache executable from the command line, and it runs in that console window, which must be left open for the duration of the Apache process.This also means that you must be logged onto the machine in order for Apache to be running - it does not start automatically on a reboot, even if you have it in your "Startup" folder, unless you first log on.

To stop or restart the Apache process, you need to open up another DOS window, and type

apache -k shutdown
Simply closing the window in which Apache is running will cause Apache to exit immediately, without cleaning up after itself. If you do that, the next time you start Apache, it will complain about the pid file not being cleaned up:
[Tue Jan 04 21:15:32 2000] [warn] pid filec:/httpd/logs/httpd.pid
overwritten -- Unclean shutdown of previous Apache run?
This is probably not a big deal, since you're unlikely to be running production services on a Win9x machine anyway.

But there's no GUI!

One of the common complaints about Apache, and about Unix in general, is that configuration is just too darned difficult. What this usually means is one of two things. Either it is referring to the fact that every stinkin' application has a different configuration file format, or the fact that most of them don't have a nice GUI for configuration.

Now, you might be a die-hard Unix bigot, like me, and quite content with the notion that if software was hard to write, it should be hard to use. But that's no longer an acceptable notion, particularly in the NT world, where people are quite content to use an inferior product, if it is easier to use. One does not have to look any farther than NT itself for evidence of this.

Fortunately, there is Comanche. Comanche is a GUI for configuring Apache, which can be found at www.comanche.org. It works not only Apache, but any application that has a text configuration file. There are currently Comanche plug-ins that let you configure Comanche and Samba, and it is fairly simple to write extensions for it to configure anything else.

Using modules on NT Apache

Apache modules on NT are implemented as DLL files, so you can just load the ones that you want, and leave out the ones that you don't, and you don't have to recompile Apache to do this. That's nice. You can load a module with the <#item_LoadModule>LoadModule directive.
LoadModule speling_module modules/ApacheModuleSpeling.dll
mod_perl

mod_perl, in case you're not familiar with it, is a module that loads the Perl interpreter into memory at server startup, so that Perl CGI programs don't have to pay that startup cost every time they are run. Additionally, mod_perl lets you write Apache modules in Perl.

For more information on mod_perl, see http://perl.apache.org

Installing mod_perl on NT is less than obvious. Fortunately, some kind person (Randy Kobes) has done this work for you, and you can just grab the binaries, and go from there. You can get those binaries at ftp://theoryx5.uwinnipeg.ca/pub/other/ These include Perl from ActiveState, and Apache binaries. There is some manual setup that has to be done, but that should not be too much of a hardship.

The problem with mod_perl on NT, at the moment, is that it is single-threaded, so you don't gain much by using it. With the recent release of 2.0, we hope to see some improvements in this area.

The future for NT Apache?

Apache 2.0 alpha was released on March 10. Bill Stoddard, who is the main developer of Apache for Windows, says that he's getting enormous speed improvements with the new code, and that it is almost as fast as Apache on Linux now. And, when 2.0 gets out of Beta, that dreaded "experimental" warning will finally go away. You can read more about Apache 2.0 at http://www.apache.org/docs/new_features_2_0.html

Additional information

There's very little information online about Apache on Windows. The main reason for this is that Apache on NT is really not very much different from Apache on Unix, and the documentation covers the differences adequately. However, I suspect that the other reason is that there are not nearly as many people running Apache on NT as on Unix, and those that would be running it on NT are being scared off by that comment that Apache on Windows is "entirely experimental."

You'll find a document at http://www.apache.org/docs/windows.html that covers some of the Windows-specific things, and the rest, such as configuration directives, are found at their appropriate places throughout the documentation.

There's really not one central place where Apache on NT is specifically discussed, at least that I've found. Of course, there's this document. While I would not presume to claim that it is complete or authoritative, I think that it covers the main points adequately. Please let me know if I've left anything out, or made any glaring errors.





Page 2 of 2



Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Sitemap | Contact Us

Rocket Fuel