From 1b8894d367c7652569dc13fb03f179fcdc2a8a66 Mon Sep 17 00:00:00 2001
From: Bill Stoddard There are many important points before you begin compiling Apache.
+ See Using Apache with Microsoft Windows
+ before you begin. Compiling Apache requires Microsoft Visual C++ 5.0 (or later) to be
+ properly installed. It is easiest to compile with the command-line tools
+ (nmake, etc...). Consult the VC++ manual to determine how to install
+ them. First, unpack the Apache distribution into an appropriate
+ directory. Open a command-line prompt, and change to the
+ The master Apache makefile instructions are contained in the
+ These will both compile Apache. The latter will include debugging
+ information in the resulting files, making it easier to find bugs and
+ track down problems. Apache can also be compiled using VC++'s Visual Studio development
+ environment. Although compiling Apache in this manner is not as
+ simple, it makes it possible to easily modify the Apache source, or
+ to compile Apache if the command-line tools are not installed.
+ Project files (Compiling Apache for Microsoft Windows
+
+src
subdirectory of the Apache distribution.Makefile.win
file. To compile Apache on Windows, simply
+ use one of the following commands:
+
+
+
+nmake /f Makefile.win _apacher
(release build)
+nmake /f Makefile.win _apached
(debug build)
+.DSP
) are included for each of the
+ portions of Apache. To build Apache from the these projects files
+ you will need to build the following projects in this order:
+ This needs updating for Apache 2.0
+
+
+
+ In addition, the os\win32\ApacheOS.dsp
+ regex\regex.dsp
+ ap\ap.dsp
+ main\gen_uri_delims.dsp
+ main\gen_test_char.dsp
+ ApacheCore.dsp
+ Apache.dsp
+ src\os\win32
subdirectory contains
+ project files for the optional modules (see below).
Once Apache has been compiled, it needs to be installed in its server
+ root directory. The default is the \Apache
+ directory, on the current hard drive.
To install the files into the \Apache
directory
+ automatically, use one the following nmake commands (see above):
nmake /f Makefile.win installr INSTDIR=dir
+ (for release build)
+nmake /f Makefile.win installd INSTDIR=dir
+ (for debug build)
+This will install the following:
+ +dir\Apache.exe
- Apache executable
+ dir\ApacheCore.dll
- Main Apache shared library
+ dir\modules\ApacheModule*.dll
- Optional Apache
+ modules (7 files)
+ dir\conf
- Empty configuration directory
+ dir\logs
- Empty logging directory
+If you do not have nmake, or wish to install in a different directory, + be sure to use a similar naming scheme.
+ ++Before running the server you must fill out the conf directory. +Copy the *.conf-dist-win from the distribution conf directory +and rename *.conf. Edit the @@ServerRoot@@ entries to your +actual server root (for example "C:\apache"). Copy over +the conf/magic and conf/mime.types files as well. + + + + diff --git a/docs/manual/platform/windows.html b/docs/manual/platform/windows.html index 95bcef390a..fbe075fbce 100644 --- a/docs/manual/platform/windows.html +++ b/docs/manual/platform/windows.html @@ -21,12 +21,10 @@ to contribute in other ways, please use our bug reporting page.
-- -Most of this document assumes that you are installing Windows from a -binary distribution. If you want to compile Apache yourself (possibly -to help with development, or to track down bugs), see the section on -Compiling Apache for Windows below. +
Most of this document assumes that you are installing Windows from a + binary distribution. If you want to compile Apache yourself (possibly + to help with development, or to track down bugs), see + Compiling Apache for Microsoft Windows.
Apache 2.0 is designed to run on Windows NT 4.0 and Windows 2000. The + binary installer will only work in Intel processors. Apache may also + run on Windows 95 and 98, but these have not been tested, and are never + recommended for production servers. In all cases TCP/IP networking must + be installed.
-+
If running on Windows 95, the "Winsock2" upgrade MUST BE INSTALLED. + "Winsock2" for Windows 95 is available + here.
-If running on Windows 95, using the "Winsock2" upgrade is REQUIRED. "Winsock 2" -for Windows 95 is available here. +If running on NT 4.0, installing Service Pack 3 is recommended, and + Service Pack 4 created known issues with Tcpip/winsock integrety that + were resolved in Service Pack 5.
-If running on NT 4.0, installing Service Pack 2 is recommended. -
Information on the latest version of Apache can be found on the -Apache web server at http://www.apache.org/httpd. This will -list the current release, any more recent alpha or beta-test releases, -together with details of mirror web and anonymous ftp sites.
- -
-
-You should download the version of Apache for Windows with the
-.exe
extension. This is a single file containing Apache,
-ready to install and run. There may also be a .zip
file
-containing the source code, to compile Apache yourself. (If there is
-no .zip file, the source will be available in a
-.tar.gz file but this will contain Unix line endings. You
-will have to convert at least the .mak and
-.dsp files to have DOS line endings before MSVC will
-understand them).
+ Apache web server at
+ http://www.apache.org/httpd. This will list the current release,
+ any more recent alpha or beta-test releases, together with details of
+ mirror web and anonymous ftp sites.
You should download the version of Apache for Windows with the
+ .exe
extension. This is a single file containing Apache,
+ ready to install and run. There may also be a .zip
file
+ containing the source code, to compile Apache yourself. (If there is
+ no .zip file, the source will be available in a
+ .tar.gz file but this will contain Unix line endings. You
+ will have to convert at least the .mak and
+ .dsp files to have DOS line endings before MSVC will
+ understand them).
Run the Apache .exe file you downloaded above. This will + ask for:
- -During the installation, Apache will configure the files in the -conf directory for your chosen installation -directory. However if any of the files in this directory already exist -they will not be overwritten. Instead the new copy of -the corresponding file will be left with the extension -.default. So, for example, if -conf\httpd.conf already exists it will not be altered, -but the version which would have been installed will be left in -conf\httpd.conf.default. After the installation has -finished you should manually check to see what in new in the -.default file, and if necessary update your existing -configuration files. - -
- -Also, if you already have a file called htdocs\index.html -then it will not be overwritten (no index.html.default -file will be installed either). This should mean it a safe to install -Apache over an existing installation (but you will have to stop the -existing server running before doing the installation, then start the -new one after the installation is finished). - -
- -After installing Apache, you should edit the configuration files in -the conf directory as required. These files will be -configured during the install ready for Apache to be run from the -directory where it was installed, with the documents served from the -subdirectory htdocs. There are lots of other options -which should be set before you start really using Apache. However to -get started quickly the files should work as installed. +
During the installation, Apache will configure the files in the + conf directory for your chosen installation + directory. However if any of the files in this directory already exist + they will not be overwritten. Instead the new copy of + the corresponding file will be left with the extension + .default. So, for example, if + conf\httpd.conf already exists it will not be altered, + but the version which would have been installed will be left in + conf\httpd.conf.default. After the installation has + finished you should manually check to see what in new in the + .default file, and if necessary update your existing + configuration files.
+ +Also, if you already have a file called htdocs\index.html + then it will not be overwritten (no index.html.default + file will be installed either). This should mean it a safe to install + Apache over an existing installation (but you will have to stop the + existing server running before doing the installation, then start the + new one after the installation is finished).
+ +After installing Apache, you should edit the configuration files in + the conf directory as required. These files will be + configured during the install ready for Apache to be run from the + directory where it was installed, with the documents served from the + subdirectory htdocs. There are lots of other options + which should be set before you start really using Apache. However to + get started quickly the files should work as installed.
To run Apache from a console window, select the "Start Apache as + console app" option from the Start menu (in Apache 1.3.4 and earlier, + this option was called "Apache Server"). This will open a console + window and start Apache running inside it. The window will remain + active until you stop Apache. To stop Apache running, either select + the "Shutdown Apache console app" icon option from the Start menu + (this is not available in Apache 1.3.4 or earlier), or see Signalling Console Apache when Running for how + to control Apache from the command line.
+ +If the Apache console window closes immediately (or unexpectedly), + run the "Command Prompt" from the Start Menu - Programs list. Change + to the folder to which you installed Apache, type the command apache, + and read the error message. Then change to the logs folder, and review + the error.log file for configuration mistakes. If you accepted the + defaults when you installed Apache, the commands would be:
- NET START APACHE - NET STOP APACHE + c: + cd "\program files\apache group\apache" + apache + Wait for Apache to exit, or press Ctrl+C + cd logs + more <error.log-See Signalling Service Apache when Running -for more information on installing and controlling Apache services. +
Complete the steps above before you proceed to attempt to + start Apache as a Window NT/2000 service!
-+
To start Apache as a service, you first need to install it as a + service. Multiple Apache services can be installed, each with a + different name and configuration. To install the default Apache + service named "Apache", run the "Install Apache as Service (NT only)" + option from the Start menu. Once this is done you can start the "Apache" + service by opening the Services window (in the Control Panel), selecting Apache, + then clicking on Start. Apache will now be running in the background. You + can later stop Apache by clicking on Stop. As an alternative to using + the Services window, you can start and stop the "Apache" service from the control + line with:
-To run Apache from a console window, select the "Start Apache as -console app" option from the Start menu (in Apache 1.3.4 and earlier, -this option was called "Apache Server"). This will open a console -window and start Apache running inside it. The window will remain -active until you stop Apache. To stop Apache running, either select -the "Shutdown Apache console app" icon option from the Start menu -(this is not available in Apache 1.3.4 or earlier), or see Signalling Console Apache when Running for how -to control Apache from the command line. ++ NET START APACHE + NET STOP APACHE ++ +
See Signalling Service Apache when Running + for more information on installing and controlling Apache services.
-+
Apache, unlike many other Windows NT/2000 services, logs any + errors to it's own error.log file in the logs folder within the + Apache server root folder. You will not find Apache error + details in the Windows NT Event Log.
-After starting Apache running (either in a console window or as a -service) if will be listening to port 80 (unless you changed the -Port, Listen or BindAddress -directives in the configuration files). To connect to the server and -access the default page, launch a browser and enter this URL: +After starting Apache running (either in a console window or as a + service) if will be listening to port 80 (unless you changed the + Port, Listen or BindAddress + directives in the configuration files). To connect to the server and + access the default page, launch a browser and enter this URL:
http://localhost/-This should respond with a welcome page, and a link to the Apache -manual. If nothing happens or you get an error, look in the -error_log file in the logs directory. -If your host isn't connected to the net, you may have to use -this URL: +
This should respond with a welcome page, and a link to the Apache + manual. If nothing happens or you get an error, look in the + error_log file in the logs directory. + If your host isn't connected to the net, you may have to use + this URL:
http://127.0.0.1/-
- -Once your basic installation is working, you should configure it -properly by editing the files in the conf directory. +
Once your basic installation is working, you should configure it + properly by editing the files in the conf directory. + Again, if you change the configuration of the Windows NT/2000 + service for Apache, first attempt to start it from the command + line to assure that the service starts with no errors.
+
Apache is configured by files in the conf + directory. These are the same as files used to configure the Unix + version, but there are a few different directives for Apache on + Windows. See the Apache documentation for all the + available directives.
-The main differences in Apache for Windows are: +The main differences in Apache for Windows are:
Because Apache for Windows is multithreaded, it does not use a @@ -270,58 +280,94 @@ The main differences in Apache for Windows are:
+
Note: The -n option to specify a service name is only available + with Apache 1.3.7 and later. Earlier versions of Apache only support + the default service name 'Apache'.
-You can install Apache as a Windows NT service as follows: +You can install Apache as a Windows NT service as follows:
apache -i -n "service name"-To install a service to use a particular configuration, specify the -configuration file when the service is installed: + To install a service to use a particular configuration, specify the + configuration file when the service is installed:
apache -i -n "service name" -f "\my server\conf\my.conf"-To remove an Apache service, use + To remove an Apache service, use
apache -u -n "service name"-The default "service name", if one is not specified, is "Apache". + The default "service name", if one is not specified, is "Apache". -
+
Once a service is installed, you can use the -n option, in + conjunction with other options, to refer to a service's configuration + file. For example:
-Once a service is installed, you can use the -n option, in conjunction -with other options, to refer to a service's configuration file. For example:To test a service's configuration file:
-To test a service's configuration file:apache -n "service name" -t-To start a console Apache using a service's configuration file: +
To start a console Apache using a service's configuration file:
+apache -n "service name"+
Important Note on service dependencies:
+ +Prior to Apache release 1.3.13, the dependencies required to + successfully start an installed service were not configured. + After installing a service using earlier versions of Apache, + you must follow these steps: + +
+ Run regedt32 + Select Window - "HKEY_LOCAL_MACHINE on Local Machine" from the menu + Double-click to open the SYSTEM, then the CurrentControlSet keys + Scroll down and click on the Apache servicename + Select Edit - Add Value... from the menu + Fill in the Add Value dialog with + Value Name: DependOnGroup + Data Type: REG_MULTI_SZ + and click OK + Leave the Multi-String Editor dialog empty and click OK + Select Edit - Add Value... from the menu + Fill in the Add Value dialog with + Value Name: DependOnService + Data Type: REG_MULTI_SZ + and click OK + Type the following list (one per line) in the Multi-String Editor dialog + Tcpip + Afd + and click OK ++ +
If you are using COM or DCOM components from a third party module, ISAPI, + or other add-in scripting technologies such as ActiveState Perl, you may + also need to add the entry Rpcss to the DependOnService list. To avoid + exposing the TCP port 135 when it is unnecessary, Apache does not create + that entry upon installation. Follow the directions above to find or + create the DependOnService value, double click that value if it already + exists, and add the Rpcss entry to the list.
+The Start menu icons and the NT Service manager can provide a simple + interface for administering Apache. But in some cases it is easier to + work from the command line.
--When working with Apache it is important to know how it will find the -configuration files. You can specify a configuration file on the command line -in two ways: +
When working with Apache it is important to know how it will find the + configuration files. You can specify a configuration file on the command line + in two ways:
apache -n "service name"-In these cases, the proper ServerRoot should be set in the configuration file. - -
+ In these cases, the proper ServerRoot should be set in the configuration file.
-If you don't specify a configuration file name with -f or -n, Apache will -use the file name compiled into the server, usually "conf/httpd.conf". Invoking -Apache with the -V switch will display this value labeled as SERVER_CONFIG_FILE. -Apache will then determine its ServerRoot by trying the following, in this order: +If you don't specify a configuration file name with -f or -n, Apache will + use the file name compiled into the server, usually "conf/httpd.conf". Invoking + Apache with the -V switch will display this value labeled as SERVER_CONFIG_FILE. + Apache will then determine its ServerRoot by trying the following, in this order:
-The server root compiled into the server is usually "/apache". -invoking apache with the -V switch will display this value -labeled as HTTPD_ROOT. +
The server root compiled into the server is usually "/apache". + invoking apache with the -V switch will display this value + labeled as HTTPD_ROOT.
+ +When invoked from the start menu, Apache is usually passed no arguments, + so using the registry entry is the preferred technique for console Apache.
--When invoked from the start menu, Apache is usually passed no arguments, -so using the registry entry is the preferred technique for console Apache. +
During a binary installation, a version-specific registry key is created + in the Windows registry: -
-During a binary installation, a registry key will have -been installed, for example:
- HKEY_LOCAL_MACHINE\Software\Apache Group\Apache\1.3.4\ServerRoot + HKEY_LOCAL_MACHINE\Software\Apache Group\Apache\1.3.7 + + HKEY_LOCAL_MACHINE\Software\Apache Group\Apache\2.0a3-
-This key is compiled into the server and can enable you to test -new versions without affecting the current version. Of course -you must take care not to install the new version on top of the -old version in the file system. - -
-If you did not do a binary install then Apache will in some -scenarios complain that about the missing registry key. This -warning can be ignored if it otherwise was able to find its -configuration files. - -
-The value of this key is the "ServerRoot" directory, containing the -conf directory. When Apache starts it will read the -httpd.conf file from this directory. If this file -contains a ServerRoot directive which is different from -the directory obtained from the registry key above, Apache will forget -the registry key and use the directory from the configuration file. -If you copy the Apache directory or configuration files to a new -location it is vital that you update the ServerRoot -directory in the httpd.conf file to the new location. - -
-To run Apache from the command line as a console application, use the -following command: +
This key is compiled into the server and can enable you to test + new versions without affecting the current version. Of course + you must take care not to install the new version on top of the + old version in the file system.
+ +If you did not do a binary install then Apache will in some + scenarios complain that about the missing registry key. This + warning can be ignored if it otherwise was able to find its + configuration files.
+ +The value of this key is the "ServerRoot" directory, containing the + conf directory. When Apache starts it will read the + httpd.conf file from this directory. If this file + contains a ServerRoot directive which is different from + the directory obtained from the registry key above, Apache will forget + the registry key and use the directory from the configuration file. + If you copy the Apache directory or configuration files to a new + location it is vital that you update the ServerRoot + directory in the httpd.conf file to the new location. + +
To run Apache from the command line as a console application, use the + following command:
apache-Apache will execute, and will remain running until it is stopped by pressing -control-C. + Apache will execute, and will remain running until it is stopped by pressing + control-C.
On Windows NT, multiple instances of Apache can be run as services. + Signal an Apache service to start, restart, or shutdown as follows:
apache -n "service name" -k start @@ -411,8 +451,8 @@ Signal an Apache service to start, restart, or shutdown as follows: apache -n "service name" -k shutdown-In addition, you can use the native NT NET command to -start and stop Apache services as follows: +
In addition, you can use the native NT NET command to + start and stop Apache services as follows:
NET START "service name" @@ -421,125 +461,42 @@ start and stop Apache services as follows:Signalling Console Apache when running
-On Windows 95, Apache runs as a console application. You can tell a -running Apache to stop by opening another console window and running +On Windows 95, Apache runs as a console application. You can tell a + running Apache to stop by opening another console window and typing:
apache -k shutdown+Note: This option is only available with Apache 1.3.3 and later. For earlier versions, you need to use Control-C in the Apache console window to shut down the server.--This should be used instead of pressing Control-C in the running -Apache console window, because it lets Apache end any current -transactions and cleanup gracefully. +
This should be used instead of pressing Control-C in the running + Apache console window, because it lets Apache end any current + transactions and cleanup gracefully.
-- -You can also tell Apache to restart. This makes it re-read the -configuration files. Any transactions in progress are allowed to -complete without interruption. To restart Apache, run +
You can also tell Apache to restart. This makes it re-read the + configuration files. Any transactions in progress are allowed to + complete without interruption. To restart Apache, run
apache -k restart+- Note: This option is only available with Apache 1.3.3 and - later. For earlier versions, you need to use Control-C in the - Apache console window to shut down the server. + Note: This option is only available with Apache 1.3.3 and + later. For earlier versions, you need to use Control-C in the + Apache console window to shut down the server.--Note for people familiar with the Unix version of Apache: these -commands provide a Windows equivalent to
kill -TERM -pid
andkill -USR1 pid
. The command -line option used,-k
, was chosen as a reminder of the -"kill" command used on Unix. - -Compiling Apache for Windows
- -Compiling Apache requires Microsoft Visual C++ 5.0 (or later) to be - properly installed. It is easiest to compile with the command-line tools - (nmake, etc...). Consult the VC++ manual to determine how to install - them.
- -First, unpack the Apache distribution into an appropriate - directory. Open a command-line prompt, and change to the -
- -src
subdirectory of the Apache distribution.The master Apache makefile instructions are contained in the -
Makefile.win
file. To compile Apache on Windows, simply - use one of the following commands: -
nmake /f Makefile.win _apacher
(release build)
-nmake /f Makefile.win _apached
(debug build)
-These will both compile Apache. The latter will include debugging - information in the resulting files, making it easier to find bugs and - track down problems.
- -Apache can also be compiled using VC++'s Visual Studio development
- environment. Although compiling Apache in this manner is not as
- simple, it makes it possible to easily modify the Apache source, or
- to compile Apache if the command-line tools are not installed.
- Project files (.DSP
) are included for each of the
- portions of Apache. To build Apache from the these projects files
- you will need to build the following projects in this order:
- This needs updating for Apache 2.0
-
os\win32\ApacheOS.dsp
- regex\regex.dsp
- ap\ap.dsp
- main\gen_uri_delims.dsp
- main\gen_test_char.dsp
- ApacheCore.dsp
- Apache.dsp
- src\os\win32
subdirectory contains
- project files for the optional modules (see below).
-
-Once Apache has been compiled, it needs to be installed in its server
- root directory. The default is the \Apache
- directory, on the current hard drive.
To install the files into the \Apache
directory
- automatically, use one the following nmake commands (see above):
nmake /f Makefile.win installr INSTDIR=dir
- (for release build)
-nmake /f Makefile.win installd INSTDIR=dir
- (for debug build)
-This will install the following:
- -dir\Apache.exe
- Apache executable
- dir\ApacheCore.dll
- Main Apache shared library
- dir\modules\ApacheModule*.dll
- Optional Apache
- modules (7 files)
- dir\conf
- Empty configuration directory
- dir\logs
- Empty logging directory
-If you do not have nmake, or wish to install in a different directory, - be sure to use a similar naming scheme.
- --Before running the server you must fill out the conf directory. -Copy the *.conf-dist-win from the distribution conf directory -and rename *.conf. Edit the @@ServerRoot@@ entries to your -actual server root (for example "C:\apache"). Copy over -the conf/magic and conf/mime.types files as well. +
Note for people familiar with the Unix version of Apache: these
+ commands provide a Windows equivalent to kill -TERM
+ pid
and kill -USR1 pid
. The command
+ line option used, -k
, was chosen as a reminder of the
+ "kill" command used on Unix.