Skip to content Skip to sidebar Skip to footer

Why Do I Have to Install Http-server Again

Using Apache HTTP Server on Microsoft Windows

Available Languages:  en  |  fr  |  ko

This certificate explains how to install, configure and run Apache two.iv under Microsoft Windows. If you have questions afterward reviewing the documentation (and whatsoever event and error logs), y'all should consult the peer-supported users' mailing listing.

This document assumes that y'all are installing a binary distribution of Apache. If yous desire to compile Apache yourself (possibly to assistance with development or tracking down bugs), come across Compiling Apache for Microsoft Windows.

Support Apache!

See too

  • Comments

top

Operating System Requirements

The primary Windows platform for running Apache 2.iv is Windows 2000 or later. Always obtain and install the current service pack to avoid operating arrangement bugs.

Apache HTTP Server versions afterwards than 2.2 volition not run on whatever operating arrangement before than Windows 2000.

top

Downloading Apache for Windows

The Apache HTTP Server Project itself does non provide binary releases of software, only source lawmaking. Individual committers may provide binary packages as a convenience, but it is not a release deliverable.

If you cannot compile the Apache HTTP Server yourself, you tin can obtain a binary parcel from numerous binary distributions available on the Internet.

Popular options for deploying Apache httpd, and, optionally, PHP and MySQL, on Microsoft Windows, include:

  • ApacheHaus
  • Apache Lounge
  • Bitnami WAMP Stack
  • WampServer
  • XAMPP

top

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, just there are a few different directives for Apache on Windows. Encounter the directive alphabetize 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 process for each request, every bit Apache can on Unix. Instead there are usually merely two Apache processes running: a parent procedure, and a child which handles the requests. Within the child procedure each request is handled by a carve up thread.

    The process management directives are also dissimilar:

    MaxConnectionsPerChild: Like the Unix directive, this controls how many connections a single child process will serve earlier exiting. Nonetheless, unlike on Unix, a replacement process is not instantly available. Apply the default MaxConnectionsPerChild 0, unless instructed to alter the behavior to overcome a memory leak in third party modules or in-procedure applications.

    Warning: The server configuration file is reread when a new kid process is started. If you have modified httpd.conf, the new child may non kickoff or yous may receive unexpected results.

    ThreadsPerChild: This directive is new. It tells the server how many threads it should use. This is the maximum number of connections the server can handle at in one case, so exist sure to fix this number high plenty for your site if you get a lot of hits. The recommended default is ThreadsPerChild 150, but this must exist adjusted to reflect the greatest anticipated number of simultaneous connections to accept.

  • The directives that take filenames as arguments must utilise Windows filenames instead of Unix ones. However, considering Apache may interpret backslashes as an "escape character" sequence, you lot should consistently employ forward slashes in path names, non backslashes.

  • While filenames are generally case-insensitive on Windows, URLs are still treated internally as case-sensitive before they are mapped to the filesystem. For example, the <Location>, Alias, and ProxyPass directives all utilise case-sensitive arguments. For this reason, it is particularly important to use the <Directory> directive when attempting to limit access to content in the filesystem, since this directive applies to any content in a directory, regardless of how information technology is accessed. If you lot wish to assure that but lowercase is used in URLs, you can use something like:

    RewriteEngine On RewriteMap lowercase int:tolower RewriteCond "%{REQUEST_URI}" "[A-Z]" RewriteRule "(.*)" "${lowercase:$1}" [R,L]
  • When running, Apache needs write access only to the logs directory and whatever configured cache directory tree. Due to the issue of example insensitive and short 8.iii format names, Apache must validate all path names given. This means that each directory which Apache evaluates, from the drive root up to the directory leaf, must have read, list and traverse directory permissions. If Apache2.4 is installed at C:\Program Files, then the root directory, Programme Files and Apache2.iv must all be visible to Apache.

  • Apache for Windows contains the ability to load modules at runtime, without recompiling the server. If Apache is compiled commonly, it volition install a number of optional modules in the \Apache2.4\modules directory. To actuate these or other modules, the LoadModule directive must be used. For case, to activate the condition module, utilize the following (in addition to the status-activating directives in access.conf):

    LoadModule status_module "modules/mod_status.and then"

    Information on creating loadable modules is also available.

  • Apache can also load ISAPI (Internet Server Awarding Programming Interface) extensions such equally those used by Microsoft IIS and other Windows servers. More information is available. Annotation that Apache cannot load ISAPI Filters, and ISAPI Handlers with some Microsoft characteristic extensions volition not piece of work.

  • When running CGI scripts, the method Apache uses to find the interpreter for the script is configurable using the ScriptInterpreterSource directive.

  • Since it is often difficult to manage files with names similar .htaccess in Windows, you may find it useful to change the name of this per-directory configuration file using the AccessFilename directive.

  • Any errors during Apache startup are logged into the Windows event log when running on Windows NT. This machinery acts equally a backup for those situations where Apache is not nevertheless prepared to employ the error.log file. You tin can review the Windows Application Result Log by using the Effect Viewer, e.grand. Get-go - Settings - Control Panel - Administrative Tools - Event Viewer.

top

Running Apache as a Service

Apache comes with a utility called the Apache Service Monitor. With it you tin can run into and manage the land of all installed Apache services on whatever machine on your network. To be able to manage an Apache service with the monitor, you have to first install the service (either automatically via the installation or manually).

You can install Apache as a Windows NT service as follows from the command prompt at the Apache bin subdirectory:

httpd.exe -k install

If you demand to specify the name of the service you want to install, use the post-obit command. You have to do this if y'all accept several different service installations of Apache on your computer. If you specify a name during the install, you have to also specify information technology during whatsoever other -thousand operation.

httpd.exe -m install -north "MyServiceName"

If you lot need to have specifically named configuration files for different services, yous must use this:

httpd.exe -k install -n "MyServiceName" -f "c:\files\my.conf"

If you apply the offset command without any special parameters except -m install, the service volition be called Apache2.iv and the configuration will be causeless to exist conf\httpd.conf.

Removing an Apache service is easy. Just utilize:

httpd.exe -g uninstall

The specific Apache service to be uninstalled can exist specified by using:

httpd.exe -k uninstall -n "MyServiceName"

Normal starting, restarting and shutting downward of an Apache service is normally done via the Apache Service Monitor, past using commands similar NET Starting time Apache2.iv and Cyberspace STOP Apache2.4 or via normal Windows service direction. Before starting Apache as a service past any means, you should exam the service's configuration file by using:

httpd.exe -n "MyServiceName" -t

You tin can control an Apache service past its command line switches, too. To offset an installed Apache service y'all'll use this:

httpd.exe -k get-go -n "MyServiceName"

To stop an Apache service via the command line switches, use this:

httpd.exe -k stop -north "MyServiceName"

or

httpd.exe -1000 shutdown -due north "MyServiceName"

Y'all can also restart a running service and force it to reread its configuration file past using:

httpd.exe -k restart -n "MyServiceName"

By default, all Apache services are registered to run as the system user (the LocalSystem account). The LocalSystem account has no privileges to your network via whatsoever Windows-secured mechanism, including the file organization, named pipes, DCOM, or secure RPC. It has, however, wide privileges locally.

Never grant any network privileges to the LocalSystem business relationship! If yous need Apache to be able to access network resources, create a separate account for Apache as noted below.

It is recommended that users create a split up account for running Apache service(due south). If y'all accept to access network resource via Apache, this is required.

  1. Create a normal domain user account, and be sure to memorize its countersign.
  2. Grant the newly-created user a privilege of Log on equally a service and Human action as part of the operating system. On Windows NT 4.0 these privileges are granted via User Manager for Domains, but on Windows 2000 and XP you probably desire to use Grouping Policy for propagating these settings. Y'all can too manually set up these via the Local Security Policy MMC snap-in.
  3. Confirm that the created account is a member of the Users group.
  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 httpd.exe binary executable.

Information technology is usually a good practice to grant the user the Apache service runs as read and execute (RX) admission to the whole Apache2.4 directory, except the logs subdirectory, where the user has to have at least change (RWXD) rights.

If you allow the business relationship to log in equally a user and equally a service, so you can log on with that account and examination that the business relationship has the privileges to execute the scripts, read the web pages, and that you lot can kickoff Apache in a console window. If this works, and you have followed the steps in a higher place, Apache should execute equally a service with no problems.

Error lawmaking 2186 is a good indication that you lot need to review the "Log On Every bit" configuration for the service, since Apache cannot access a required network resource. Also, pay close attention to the privileges of the user Apache is configured to run as.

When starting Apache as a service you may encounter an error message from the Windows Service Command Manager. For example, if you effort to start Apache by using the Services applet in the Windows Control Panel, you may go the following bulletin:

Could non start the Apache2.4 service on \\COMPUTER
Error 1067; The procedure terminated unexpectedly.

Y'all will get this generic error if in that location is whatsoever problem with starting the Apache service. In order to see what is actually causing the trouble you should follow the instructions for Running Apache for Windows from the Command Prompt.

If yous are having problems with the service, information technology is suggested you follow the instructions below to try starting httpd.exe from a console window, and work out the errors before struggling to start it as a service again.

top

Running Apache equally a Panel Application

Running Apache every bit a service is usually the recommended fashion to use it, but it is sometimes easier to work from the command line, especially during initial configuration and testing.

To run Apache from the command line every bit a console awarding, use the post-obit control:

httpd.exe

Apache will execute, and will remain running until it is stopped by pressing Command-C.

You can also run Apache via the shortcut Start Apache in Console placed to Starting time Menu --> Programs --> Apache HTTP Server 2.four.xx --> Control Apache Server during the installation. This will open a console window and start Apache inside it. If you don't have Apache installed equally a service, the window will remain visible until you stop Apache by pressing Command-C in the console window where Apache is running in. The server will leave in a few seconds. All the same, if y'all practise take Apache installed as a service, the shortcut starts the service. If the Apache service is running already, the shortcut doesn't do anything.

If Apache is running as a service, you tin tell it to stop by opening some other panel window and entering:

httpd.exe -k shutdown

Running as a service should be preferred over running in a console window because this lets Apache cease whatsoever current operations and clean up gracefully.

Merely if the server is running in a console window, yous tin merely stop it by pressing Control-C in the same window.

You lot can also tell Apache to restart. This forces information technology to reread the configuration file. Any operations in progress are allowed to complete without interruption. To restart Apache, either press Control-Intermission in the console window you used for starting Apache, or enter

httpd.exe -thousand restart

if the server is running as a service.

Annotation for people familiar with the Unix version of Apache: these commands provide a Windows equivalent to kill -TERM pid and impale -USR1 pid . The command line option used, -k, was chosen as a reminder of the kill control used on Unix.

If the Apache console window closes immediately or unexpectedly after startup, open the Command Prompt from the Start Menu --> Programs. Change to the folder to which you installed Apache, type the command httpd.exe, and read the error message. Then change to the logs binder, and review the error.log file for configuration mistakes. Bold httpd was installed into C:\Program Files\Apache Software Foundation\Apache2.4\, yous can exercise the following:

c:
cd "\Program Files\Apache Software Foundation\Apache2.4\bin"
httpd.exe

Then wait for Apache to terminate, or press Control-C. Then enter the following:

cd ..\logs
more than < error.log

When working with Apache information technology is important to know how information technology will find the configuration file. You lot can specify a configuration file on the control line in two means:

  • -f specifies an absolute or relative path to a detail configuration file:

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

    or

    httpd.exe -f files\anotherconfig.conf

  • -n specifies the installed Apache service whose configuration file is to be used:

    httpd.exe -n "MyServiceName"

In both of these cases, the proper ServerRoot should be set in the configuration file.

If you don't specify a configuration file with -f or -north, Apache will use the file name compiled into the server, such equally conf\httpd.conf. This built-in path is relative to the installation directory. You tin can verify the compiled file name from a value labelled as SERVER_CONFIG_FILE when invoking Apache with the -V switch, like this:

httpd.exe -V

Apache will then endeavor to determine its ServerRoot by trying the post-obit, 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 yous did a binary installation.
  5. The server root compiled into the server. This is /apache past default, you can verify information technology by using httpd.exe -V and looking for a value labelled every bit HTTPD_ROOT.

If you did not do a binary install, Apache will in some scenarios complain almost the missing registry central. This alert tin exist ignored if the server was otherwise able to observe its configuration file.

The value 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 directive which contains a different directory from the one obtained from the registry central to a higher place, Apache volition forget the registry cardinal and use the directory from the configuration file. If you re-create the Apache directory or configuration files to a new location it is vital that you update the ServerRoot directive in the httpd.conf file to reflect the new location.

top

Testing the Installation

Later starting Apache (either in a console window or as a service) it will exist listening on port 80 (unless you lot inverse the Mind directive in the configuration files or installed Apache simply for the electric current user). To connect to the server and admission the default page, launch a browser and enter this URL:

http://localhost/

Apache should respond with a welcome page and yous should see "Information technology Works!". If nothing happens or you go an error, look in the error.log file in the logs subdirectory. If your host is not continued to the cyberspace, or if you have serious bug with your DNS (Domain Name Service) configuration, you may accept to use this URL:

http://127.0.0.one/

If you happen to exist running Apache on an alternate port, you demand to explicitly put that in the URL:

http://127.0.0.one:8080/

Once your basic installation is working, y'all should configure it properly past editing the files in the conf subdirectory. Again, if you modify the configuration of the Windows NT service for Apache, first effort to start it from the command line to make sure that the service starts with no errors.

Considering Apache cannot share the same port with another TCP/IP application, you may need to stop, uninstall or reconfigure certain other services earlier running Apache. These alien services include other Www servers, some firewall implementations, and even some client applications (such every bit Skype) which will employ port lxxx to attempt to bypass firewall issues.

top

Configuring Access to Network Resources

Access to files over the network can be specified using two mechanisms provided by Windows:

Mapped drive letters
east.yard., Alias "/images/" "Z:/"
UNC paths
e.g., Alias "/images/" "//imagehost/world wide web/images/"

Mapped drive letters permit the administrator to maintain the mapping to a specific machine and path exterior of the Apache httpd configuration. Even so, these mappings are associated merely with interactive sessions and are not directly available to Apache httpd when it is started as a service. Apply simply UNC paths for network resources in httpd.conf so that the resource can be accessed consistently regardless of how Apache httpd is started. (Cabalistic and error prone procedures may piece of work around the restriction on mapped drive letters, but this is non recommended.)

Example DocumentRoot with UNC path

DocumentRoot "//dochost/www/html/"

Example DocumentRoot with IP accost in UNC path

DocumentRoot "//192.168.1.50/docs/"

Case Alias and corresponding Directory with UNC path

Alias "/images/" "//imagehost/www/images/"  <Directory "//imagehost/www/images/"> #... </Directory>

When running Apache httpd as a service, yous must create a separate account in society to access network resources, equally described above.

top

Windows Tuning

  • If more than than a few dozen piped loggers are used on an operating system case, scaling up the "desktop heap" is often necessary. For more detailed information, refer to the piped logging documentation.

alibuithe.blogspot.com

Source: https://httpd.apache.org/docs/2.4/platform/windows.html

Mag-post ng isang Komento for "Why Do I Have to Install Http-server Again"