Using Apache with Microsoft Windows – Apache HTTP Server

Using Apache with Microsoft Windows

available Languages : en
This text file explains how to install, configure and run Apache 2.0 under Microsoft Windows. If you find any bugs, or wish to contribute in other ways, please use our microbe report page .
This document assumes that you are installing a binary distribution of Apache. If you want to compile Apache yourself ( possibly to help with development or tracking down bugs ), see Compiling Apache for Microsoft Windows .
Because of the current versioning policies on Microsoft
Windows operating system families, this document assumes the

  • Windows NT: This means all versions of
    Windows that are based on the Windows NT kernel. Includes Windows
    NT, Windows 2000, Windows XP and Windows .Net Server 2003.
  • Windows 9x: This means older,
    consumer-oriented versions of Windows. Includes Windows 95 (also
    OSR2), Windows 98 and Windows ME.

Operating System Requirements

The primary coil Windows platform for running Apache 2.0 is Windows NT. The binary star installer lone works with the x86 family of processors, such as Intel and AMD processors. Running Apache on Windows 9x is not thoroughly tested, and it is never recommended on production systems .
On all operating systems, TCP/IP network must be installed and working. If running on Windows 95, the Winsock 2 upgrade must be installed. Winsock 2 for Windows 95 can be downloaded from here .
On Windows NT 4.0, installing Service Pack 6 is powerfully commend, as Service Pack 4 created known issues with TCP/IP and Winsock integrity that were resolved in subsequently Service Packs .

Downloading Apache for Windows

information on the latest versions of Apache can be found on the world wide web web site of the Apache world wide web waiter at hypertext transfer protocol : // There you will find the stream let go of, deoxyadenosine monophosphate well as more holocene alpha or beta test versions, and a list of HTTP and FTP mirrors from which you can download the Apache web server. Please use a mirror near to you for a firm and reliable download .
For Windows installations you should download the adaptation of Apache for Windows with the .msi extension. This is a one Microsoft Installer file, which contains a ready-to-run translation of Apache. There is a separate .zip file, which contains alone the source code. You can compile Apache yourself with the Microsoft Visual C++ ( Visual Studio ) tools .

Installing Apache for Windows

You need Microsoft Installer 1.2 or above for the installation to work. On Windows 9x you can update your Microsoft Installer to version 2.0 here and on Windows NT 4.0 and 2000 the translation 2.0 update can be found hera. Windows XP does not need this update .
note that you can not install two versions of Apache 2.0 on the lapp calculator with the binary installer. You can, however, install a adaptation of the 1.3 series and a adaptation of the 2.0 series on the same computer without problems. If you need to have two different 2.0 versions on the lapp computer, you have to compile and install Apache from the reference .
Run the Apache .msi file you downloaded above. The facility will ask you for these things :

  1. Network Domain. Enter the DNS domain in which your server is or will be registered in. For example, if your server ‘s full DNS name is, you would type here .
  2. Server Name. Your server ‘s full DNS name. From the exemplar above, you would type here .
  3. Administrator’s Email Address. Enter the waiter administrator ‘s or webmaster ‘s e-mail address here. This address will be displayed along with error messages to the customer by default .
  4. For whom to install Apache Select for
    All Users, on Port 80, as a Service - Recommended
    if you’d like your fresh Apache to listen at larboard 80 for incoming traffic. It will run as a service ( that is, Apache will run even if no one is logged in on the server at the here and now ) Select only for
    the Current User, on Port 8080, when started Manually
    if you ‘d like to install Apache for your personal experiment or if you already have another WWW server running on larboard 80 .
  5. The installation type. Select Typical for everything except the source code and libraries for module development. With Custom you can specify what to install. A full moon install will require about 13 megabytes of complimentary disk space. This does not include the size of your web site ( second ) .
  6. Where to install. The default way is C:\Program Files\Apache Group under which a directory called Apache2 will be created by default .

During the installation, Apache will configure the files in the conf subdirectory to reflect the choose facility directory. however, if any of the shape files in this directory already exist, they will not be overwritten. rather, the new transcript of the corresponding file will be left with the extension .default. So, for case, if conf\httpd.conf already exists, it will be renamed as conf\httpd.conf.default. After the facility you should manually check to see what new settings are in the .default file, and if necessity, update your existing configuration file .
besides, if you already have a file called htdocs\index.html, it will not be overwritten ( and no index.html.default will be installed either ). This means it should be condom to install Apache over an existing installation, although you would have to stop the existing running waiter before doing the installation, and then start the new one after the facility is finished .
After installing Apache, you must edit the shape files in the conf subdirectory as required. These files will be configured during the facility so that Apache is ready to be run from the directory it was installed into, with the documents server from the subdirectory htdocs. There are lots of other options which you should set before you very start using Apache. however, to get begin cursorily, the files should work as install .

Customizing Apache for Windows

Apache is configured by the files in the conf subdirectory. These are the same files used to configure the Unix version, but there are a few different directives for Apache on Windows. See the directive index for all the available directives .
The main differences in Apache for Windows are :

  • Because Apache for Windows is multithreaded, it does not use a separate summons for each request, as Apache does on Unix. alternatively there are normally only two Apache processes running : a rear action, and a child which handles the requests. Within the child action each request is handled by a distinguish thread .
    The march management directives are besides different :
    MaxRequestsPerChild : Like the Unix directing, this controls how many requests a single child march will serve before exiting. however, unlike on Unix, a single process serves all the requests at once, not just one. If this is set, it is recommended that a identical gamey numeral is used. The recommend default, MaxRequestsPerChild 0, causes the child process to never exit .
    Warning: The server configuration
    file is reread when a new child process is started. If you have
    modified httpd.conf, the new child may not start or
    you may receive unexpected results.

    ThreadsPerChild : This directing is new. It tells the server how many threads it should use. This is the maximum phone number of connections the server can handle at once, thus be certain to set this number high adequate for your web site if you get a lot of hits. The commend default is ThreadsPerChild 50 .
  • The directives that accept filename as arguments must use Windows filenames alternatively of Unix ones. however, because Apache uses Unix-style names internally, you must use forward slashes, not backslashes. drive letters can be used ; if omitted, the drive with the Apache feasible will be assumed .
  • Apache for Windows contains the ability to load modules at runtime, without recompiling the server. If Apache is compiled normally, it will install a total of optional modules in the \Apache2\modules directory. To activate these or early modules, the newly LoadModule directive must be used. For case, to activate the condition module, use the follow ( in addition to the status-activating directives in access.conf ) :

    LoadModule status_module modules/
    information on creating loadable modules is besides available .
  • Apache can besides load ISAPI ( Internet Server Application Programming Interface ) extensions ( i.e. internet server applications ), such as those used by Microsoft IIS and other Windows servers. More information is available. note that Apache cannot warhead ISAPI Filters .
  • When running CGI scripts, the method Apache uses to find the spokesperson for the script is configurable using the ScriptInterpreterSource directive .
  • Since it is much difficult to manage files with names like .htaccess in Windows, you may find it utilitarian to change the diagnose of this per-directory configuration file using the AccessFilename directive .
  • Any errors during Apache inauguration are logged into the Windows event logarithm when running on Windows NT. This mechanism acts as a backup for those situations where Apache can not evening access the normally use error.log file. You can view the Windows consequence log by using the Event Viewer application on Windows NT 4.0, and the Event Viewer MMC snap-in on newer versions of Windows .
    Note that there is no startup error logging on
    Windows 9x because no Windows event log exists on those operating

Running Apache as a Service

Apache can be run as a overhaul on Windows NT. There is some highly experimental support for like behavior on Windows 9x .
You can install Apache as a service automatically during the initiation. If you chose to install for all users, the initiation will create an Apache service for you. If you specify to install for yourself only, you can manually register Apache as a service after the installation. You have to be a member of the Administrators group for the serve initiation to succeed .
Apache comes with a utility called the Apache Service Monitor. With it you can see and manage the state of all installed Apache services on any machine on your network. To be able to manage an Apache service with the proctor, you have to first install the service ( either mechanically via the facility or manually ) .
You can install Apache as a Windows NT servicing as follows from the control motivate at the Apache bin subdirectory :

apache -k install
If you need to specify the name of the avail you want to install, use the comply command. You have to do this if you have several different service installations of Apache on your calculator .

apache -k install -n "MyServiceName"
If you need to have specifically named shape files for different services, you must use this :

apache -k install -n "MyServiceName" -f "c:\files\my.conf"
If you use the first command without any special parameters except -k install, the service will be called Apache2 and the shape will be assumed to be conf\httpd.conf .
Removing an Apache service is easy. just manipulation :

apache -k uninstall
The specific Apache service to be uninstalled can be specified by using :

apache -k uninstall -n "MyServiceName"
Normal starting, restarting and shutting down of an Apache serve is normally done via the Apache Service Monitor, by using commands like NET START Apache2 and NET STOP
or via convention Windows serve management. Before starting Apache as a service by any means, you should test the service ‘s configuration file by using :

apache -n "MyServiceName" -t
You can control an Apache service by its command line switches, besides. To start an install Apache avail you ‘ll use this :

apache -k start
To stop an Apache service via the command wrinkle switches, use this :

apache -k stop

apache -k shutdown

You can besides restart a running service and effect it to reread its shape file by using :

apache -k restart
By default, all Apache services are registered to run as the system exploiter ( the LocalSystem report ). The LocalSystem report has no privileges to your network via any Windows-secured mechanism, including the file arrangement, named pipes, DCOM, or secure RPC. It has, however, wide privileges locally .
Never grant any network privileges to
the LocalSystem account! If you need Apache to be able
to access network resources, create a separate account for Apache as
noted below.

You may want to create a separate explanation for running Apache service ( sulfur ). particularly, if you have to access network resources via Apache, this is powerfully recommended .

  1. Create a normal domain user account, and be sure to
    memorize its password.
  2. Grant the newly-created user a privilege of Log on
    as a service
    and Act as part of the operating
    . On Windows NT 4.0 these privileges are granted via
    User Manager for Domains, but on Windows 2000 and XP you probably
    want to use Group Policy for propagating these settings. You can
    also manually set these via the Local Security Policy MMC snap-in.
  3. Confirm that the created account is a member of the Users
  4. Grant the account read and execute (RX) rights to all document
    and script folders (htdocs and cgi-bin
    for example).
  5. Grant the account change (RWXD) rights to the
    Apache logs directory.
  6. Grant the account read and execute (RX) rights to the
    Apache.exe binary executable.

It is normally a good commit to grant the exploiter the Apache service runs as learn and execute ( RX ) access to the solid Apache2 directory, except the logs subdirectory, where the exploiter has to have at least change ( RWXD ) rights .
If you allow the account to log in as a exploiter and as a serve, then you can log on with that bill and examination that the account has the privileges to execute the scripts, read the web pages, and that you can start Apache in a comfort window. If this works, and you have followed the steps above, Apache should execute as a service with no problems .
Error code 2186 is a good indication that you need to review the “ Log On As ” configuration for the service, since Apache can not entree a needed network resource. besides, pay close care to the privileges of the exploiter Apache is configured to run equally .
When starting Apache as a servicing you may encounter an error message from the Windows Service Control Manager. For exercise, if you try to start Apache by using the Services applet in the Windows Control Panel, you may get the follow message :

Could not start the Apache2 service on \\COMPUTER
Error 1067; The process terminated unexpectedly.
You will get this generic error if there is any problem with starting the Apache service. In order to see what is very causing the problem you should follow the instructions for Running Apache for Windows from the Command Prompt .
There is some digest for Apache on Windows 9x to behave in a alike manner as a service on Windows NT. It is highly
. It is not of production-class dependability, and its future is not guaranteed. It can be by and large regarded as a bad thing to play with – proceed with caution !
There are some differences between the two kinds of services you should be aware of :

  • Apache will attempt to start and if successful it will run in the background. If you run the command

    apache -n "MyServiceName" -k start
    via a shortcut on your desktop, for exercise, then if the serve starts successfully, a console window will flash up but it immediately disappears. If Apache detects any errors on startup such as incorrect entries in the httpd.conf shape file, the console windowpane will remain visible. This will display an error message which will be utilitarian in tracking down the causal agent of the trouble .
  • Windows 9x does not support NET START or NET STOP commands. You must control the Apache military service on the command prompt via the -k switches .
  • Apache and Windows 9x put up no support for running Apache as a specific user with network privileges. In fact, Windows 9x offers no security on the local machine, either. This is the dim-witted rationality because of which the Apache Software Foundation never endorses use of a Windows 9x -based system as a public Apache server. The primitive support for Windows 9x exists merely to assist the exploiter in developing web contentedness and learning the Apache server, and possibly as an intranet server on a secured, secret net .

once you have confirmed that Apache runs correctly as a console table application you can install, control and uninstall the pseudo-service with the same commands as on Windows NT. You can besides use the Apache Service Monitor to manage Windows 9x pseudo-services .

Running Apache as a Console Application

Running Apache as a service is normally the recommend means to use it, but it is sometimes easier to work from the command course ( on Windows 9x running Apache from the command line is the recommend way due to the miss of dependable service support. )
To run Apache from the command cable as a console table application, use the come command :

Apache will execute, and will remain running until it is stopped by pressing Control-C .
You can besides run Apache via the shortcut Start Apache in Console placed to Start Menu --> Programs --> Apache HTTP Server
2.0.xx --> Control Apache Server
during the facility. This will open a comfort window and start Apache inside it. If you do n’t have Apache installed as a service, the window will remain visible until you stop Apache by pressing Control-C in the comfort window where Apache is running in. The server will exit in a few seconds. however, if you do have Apache installed as a military service, the shortcut starts the serve. If the Apache overhaul is running already, the shortcut does n’t do anything .
You can tell a run Apache to stop by opening another console table window and entrance :

apache -k shutdown
This should be preferred over pressing Control-C because this lets Apache end any stream operations and clean up gracefully .
You can besides tell Apache to restart. This forces it to reread the configuration file. Any operations in progress are allowed to complete without break. To restart Apache, function :

apache -k restart
bill for people companion with the Unix version of Apache : these commands provide a Windows equivalent to kill -TERM
and kill -USR1 pid. The control note choice used, -k, was chosen as a reminder of the kill command used on Unix .
If the Apache console window closes immediately or unexpectedly after inauguration, open the Command Prompt from the Start Menu — > Programs. Change to the booklet to which you installed Apache, type the instruction apache, and read the erroneousness message. then change to the logs folder, and review the error.log file for shape mistakes. If you accepted the defaults when you installed Apache, the commands would be :

cd "\Program Files\Apache Group\Apache2\bin"
then expect for Apache to stop, or press Control-C. then enter the pursue :

cd ..\logs
more < error.log
When working with Apache it is important to know how it will find the configuration charge. You can specify a shape file on the command line in two ways :

  • -f specifies an absolute or relative path to a finical shape file :

    apache -f "c:\my server files\anotherconfig.conf"

    apache -f files\anotherconfig.conf
  • -n specifies the install Apache service whose configuration charge is to be used :

    apache -n "MyServiceName"

In both of these cases, the proper ServerRoot should be set in the configuration file .
If you do n't specify a shape file with -f or -n, Apache will use the file name compiled into the server, such as conf\httpd.conf. This built-in way is proportional to the initiation directory. You can verify the compiled file name from a value labelled as SERVER_CONFIG_FILE when invoking Apache with the -V trade, like this :

apache -V
Apache will then try to determine its
by trying the watch, in this order :

  1. A ServerRoot directive
    via the -C command line switch.
  2. The -d switch on the command line.
  3. Current working directory.
  4. A registry entry which was created if you did a binary
  5. The server root compiled into the server. This is
    by default, you can verify it by using
    apache -V
    and looking for a value labelled as

During the facility, a version-specific register key is created in the Windows register. The placement of this keystone depends on the type of the facility. If you chose to install Apache for all users, the key is located under the HKEY_LOCAL_MACHINE hive, like this ( the version numbers will of course vary between different versions of Apache :

HKEY_LOCAL_MACHINE\SOFTWARE\Apache Group\Apache\2.0.43
correspondingly, if you chose to install Apache for the current user only, the key is located under the HKEY_CURRENT_USER beehive, the contents of which are dependent of the drug user presently logged on :

HKEY_CURRENT_USER\SOFTWARE\Apache Group\Apache\2.0.43
This key is compiled into the server and can enable you to test new versions without affecting the current interpretation. Of course, you must take care not to install the new version in the lapp directory as another translation .
If you did not do a binary star install, Apache will in some scenarios complain about the missing register key. This admonition can be ignored if the waiter was otherwise able to find its shape file .
The measure of this key is the ServerRoot directory which contains the conf subdirectory. When Apache starts it reads the httpd.conf file from that directory. If this file contains a ServerRoot directing which contains a unlike directory from the one obtained from the register identify above, Apache will forget the register winder and use the directory from the configuration file. If you copy the Apache directory or configuration files to a new placement it is vital that you update the ServerRoot directive in the httpd.conf charge to reflect the newfangled location .

Testing the Installation

After starting Apache ( either in a console windowpane or as a service ) it will be listening on port 80 ( unless you changed the Listen directive in the configuration files or installed Apache only for the current drug user ). To connect to the server and entree the nonpayment page, launch a browser and enroll this url :

Apache should respond with a welcome foliate and a link to the Apache manual. If nothing happens or you get an erroneousness, expression in the error.log file in the logs subdirectory. If your host is not connected to the net, or if you have serious problems with your DNS ( Domain Name Service ) shape, you may have to use this url :
once your basic installation is working, you should configure it properly by editing the files in the conf subdirectory. Again, if you change the shape of the Windows NT service for Apache, first attack to start it from the command line to make sure that the avail starts with no errors .
Because Apache cannot share the like port with another TCP/IP application, you may need to stop, uninstall or reconfigure certain other services before running Apache. These conflicting services include other WWW servers and some firewall implementations .

source :
Category : Tech

About admin

I am the owner of the website, my purpose is to bring all the most useful information to users.

Check Also


Manage participants in a zoom meeting webinar

Call the people who attend the meet as follows Alternate host host Who scheduled the …

Leave a Reply

Your email address will not be published.