banner



How To Install Apache Server In Windows 10

Using Apache HTTP Server on Microsoft Windows

Available Languages:  en  |  fr  |  ko

This document explains how to install, configure and run Apache ii.4 under Microsoft Windows. If you lot have questions after reviewing the documentation (and any consequence and error logs), you should consult the peer-supported users' mailing listing.

This document assumes that yous are installing a binary distribution of Apache. If you lot want to compile Apache yourself (mayhap to help with development or tracking downwardly bugs), see Compiling Apache for Microsoft Windows.

Support Apache!

Come across also

  • Comments

top

Operating System Requirements

The primary Windows platform for running Apache 2.iv is Windows 2000 or subsequently. Always obtain and install the electric current service pack to avert operating organization bugs.

Apache HTTP Server versions later than two.2 will not run on whatsoever operating organisation before than Windows 2000.

top

Downloading Apache for Windows

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

If y'all cannot compile the Apache HTTP Server yourself, y'all can obtain a binary package from numerous binary distributions available on the Internet.

Pop 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, simply there are a few dissimilar 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 procedure for each request, as Apache can on Unix. Instead there are usually only ii Apache processes running: a parent process, and a child which handles the requests. Inside the child process each request is handled by a separate thread.

    The process management directives are also different:

    MaxConnectionsPerChild: Like the Unix directive, this controls how many connections a unmarried child procedure will serve before exiting. Withal, dissimilar on Unix, a replacement process is non instantly available. Use the default MaxConnectionsPerChild 0, unless instructed to change the beliefs to overcome a retentivity leak in third party modules or in-process 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 not start or you lot may receive unexpected results.

    ThreadsPerChild: This directive is new. Information technology tells the server how many threads it should utilize. This is the maximum number of connections the server can handle at once, and then be sure to set this number high enough for your site if you lot get a lot of hits. The recommended default is ThreadsPerChild 150, but this must be adjusted to reflect the greatest anticipated number of simultaneous connections to accept.

  • The directives that take filenames as arguments must use Windows filenames instead of Unix ones. However, because Apache may interpret backslashes equally an "escape grapheme" sequence, you should consistently use forward slashes in path names, not backslashes.

  • While filenames are generally case-insensitive on Windows, URLs are nonetheless 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 of import 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 wish to clinch that simply lowercase is used in URLs, you tin apply something like:

    RewriteEngine On RewriteMap lowercase int:tolower RewriteCond "%{REQUEST_URI}" "[A-Z]" RewriteRule "(.*)" "${lowercase:$1}" [R,L]
  • When running, Apache needs write admission just to the logs directory and any configured enshroud directory tree. Due to the issue of case insensitive and brusk 8.three format names, Apache must validate all path names given. This ways 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:\Plan Files, then the root directory, Program Files and Apache2.4 must all be visible to Apache.

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

    LoadModule status_module "modules/mod_status.so"

    Information on creating loadable modules is also bachelor.

  • Apache can also load ISAPI (Internet Server Application Programming Interface) extensions such as those used past Microsoft IIS and other Windows servers. More data is available. Annotation that Apache cannot load ISAPI Filters, and ISAPI Handlers with some Microsoft characteristic extensions will not piece of work.

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

  • Since it is frequently difficult to manage files with names similar .htaccess in Windows, you lot may notice 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 result log when running on Windows NT. This mechanism acts as a fill-in for those situations where Apache is not yet prepared to use the fault.log file. Y'all tin review the Windows Application Event Log by using the Effect Viewer, e.g. Start - Settings - Control Panel - Administrative Tools - Consequence Viewer.

top

Running Apache as a Service

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

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

httpd.exe -g install

If you need to specify the name of the service y'all want to install, use the post-obit command. You have to do this if you take several unlike service installations of Apache on your estimator. If you specify a name during the install, you have to too specify it during any other -grand functioning.

httpd.exe -one thousand install -north "MyServiceName"

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

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

If you use the first command without any special parameters except -thou install, the service will exist chosen Apache2.4 and the configuration will be assumed to be conf\httpd.conf.

Removing an Apache service is easy. Simply utilise:

httpd.exe -grand uninstall

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

httpd.exe -k uninstall -n "MyServiceName"

Normal starting, restarting and shutting downwardly of an Apache service is unremarkably done via the Apache Service Monitor, by using commands like NET Starting time Apache2.4 and Internet STOP Apache2.4 or via normal Windows service management. Earlier starting Apache as a service by any ways, you should exam the service'south configuration file by using:

httpd.exe -n "MyServiceName" -t

You tin can control an Apache service past its command line switches, too. To start an installed Apache service yous'll utilise this:

httpd.exe -k start -northward "MyServiceName"

To stop an Apache service via the control line switches, utilise this:

httpd.exe -k finish -n "MyServiceName"

or

httpd.exe -k shutdown -n "MyServiceName"

You tin as well 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 arrangement user (the LocalSystem business relationship). The LocalSystem business relationship has no privileges to your network via any Windows-secured machinery, including the file system, named pipes, DCOM, or secure RPC. Information technology has, yet, wide privileges locally.

Never grant whatsoever network privileges to the LocalSystem account! If you demand Apache to be able to admission network resources, create a separate account for Apache as noted beneath.

It is recommended that users create a separate account for running Apache service(south). If you take to admission network resources 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 Deed as function of the operating organisation. On Windows NT 4.0 these privileges are granted via User Manager for Domains, merely on Windows 2000 and XP you probably want to use Group Policy for propagating these settings. You lot can besides manually set these via the Local Security Policy MMC snap-in.
  3. Confirm that the created account is a member of the Users grouping.
  4. Grant the business relationship read and execute (RX) rights to all document and script folders (htdocs and cgi-bin for example).
  5. Grant the business relationship change (RWXD) rights to the Apache logs directory.
  6. Grant the account read and execute (RX) rights to the httpd.exe binary executable.

It is usually a adept practice to grant the user the Apache service runs as read and execute (RX) access to the whole Apache2.iv directory, except the logs subdirectory, where the user has to have at least modify (RWXD) rights.

If yous permit the account to log in as a user and every bit a service, so you tin log on with that account and exam that the business relationship has the privileges to execute the scripts, read the web pages, and that you can offset Apache in a console window. If this works, and y'all have followed the steps above, Apache should execute as a service with no problems.

Mistake code 2186 is a expert indication that you demand to review the "Log On As" configuration for the service, since Apache cannot access a required network resource. Also, pay shut attention to the privileges of the user Apache is configured to run every bit.

When starting Apache as a service you may encounter an error message from the Windows Service Control Manager. For instance, if you endeavour to start Apache by using the Services applet in the Windows Control Console, you may go the post-obit bulletin:

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

You will get this generic mistake if there is any problem with starting the Apache service. In order to come across what is really causing the problem you should follow the instructions for Running Apache for Windows from the Command Prompt.

If you are having issues with the service, it is suggested y'all follow the instructions beneath to endeavour starting httpd.exe from a panel window, and work out the errors earlier struggling to start it every bit a service once more.

top

Running Apache as a Console Application

Running Apache as a service is usually the recommended way to employ it, merely information technology is sometimes easier to work from the control line, specially during initial configuration and testing.

To run Apache from the control line equally a console awarding, use the following command:

httpd.exe

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

You can too run Apache via the shortcut Start Apache in Console placed to Start Menu --> Programs --> Apache HTTP Server two.four.20 --> Control Apache Server during the installation. This will open a console window and start Apache inside information technology. If you don't have Apache installed as a service, the window will remain visible until you cease Apache past pressing Control-C in the panel window where Apache is running in. The server will exit in a few seconds. Nonetheless, if you practice have Apache installed equally 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, y'all can tell it to stop by opening some other console window and inbound:

httpd.exe -k shutdown

Running equally a service should be preferred over running in a console window because this lets Apache finish any current operations and clean upwards gracefully.

Just if the server is running in a console window, y'all can merely stop it by pressing Control-C in the same window.

Y'all tin also tell Apache to restart. This forces it to reread the configuration file. Any operations in progress are allowed to complete without interruption. To restart Apache, either printing Control-Break in the panel window you used for starting Apache, or enter

httpd.exe -m restart

if the server is running equally a service.

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 choice used, -k, was chosen as a reminder of the kill command used on Unix.

If the Apache console window closes immediately or unexpectedly later on startup, open the Command Prompt from the Start Carte du jour --> Programs. Alter to the folder to which you lot installed Apache, blazon the control httpd.exe, and read the error message. And then modify to the logs binder, and review the fault.log file for configuration mistakes. Assuming httpd was installed into C:\Program Files\Apache Software Foundation\Apache2.iv\, y'all tin exercise the following:

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

And so wait for Apache to finish, or press Control-C. And so enter the following:

cd ..\logs
more < mistake.log

When working with Apache information technology is of import to know how it will find the configuration file. You tin specify a configuration file on the command line in two ways:

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

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

    or

    httpd.exe -f files\anotherconfig.conf

  • -due north specifies the installed Apache service whose configuration file is to exist used:

    httpd.exe -due north "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 volition employ the file proper noun compiled into the server, such as conf\httpd.conf. This built-in path is relative to the installation directory. Y'all 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 -5

Apache volition then try to determine its ServerRoot by trying the following, in this order:

  1. A ServerRoot directive via the -C control 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 installation.
  5. The server root compiled into the server. This is /apache by default, you can verify it by using httpd.exe -V and looking for a value labelled equally HTTPD_ROOT.

If yous did non exercise a binary install, Apache will in some scenarios mutter well-nigh the missing registry key. This alert can exist ignored if the server was otherwise able to find 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 key higher up, Apache will forget the registry fundamental and utilise 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 directive in the httpd.conf file to reflect the new location.

top

Testing the Installation

After starting Apache (either in a console window or as a service) it volition be listening on port eighty (unless y'all changed the Listen directive in the configuration files or installed Apache but for the current user). To connect to the server and access the default page, launch a browser and enter this URL:

http://localhost/

Apache should respond with a welcome page and y'all should encounter "It Works!". If nothing happens or you lot get an fault, expect 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) configuration, you may accept to use this URL:

http://127.0.0.i/

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

http://127.0.0.1:8080/

In one case your basic installation is working, yous should configure it properly past editing the files in the conf subdirectory. Again, if yous alter the configuration of the Windows NT service for Apache, first attempt to starting time it from the command line to brand sure that the service starts with no errors.

Because Apache cannot share the same port with another TCP/IP application, yous may need to end, uninstall or reconfigure certain other services before running Apache. These conflicting services include other WWW servers, some firewall implementations, and fifty-fifty some customer applications (such equally Skype) which volition employ port eighty 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 messages
e.g., Allonym "/images/" "Z:/"
UNC paths
e.g., Alias "/images/" "//imagehost/www/images/"

Mapped drive letters allow the administrator to maintain the mapping to a specific machine and path outside of the Apache httpd configuration. Yet, these mappings are associated simply with interactive sessions and are not directly bachelor to Apache httpd when it is started as a service. Apply only UNC paths for network resources in httpd.conf and then that the resources can be accessed consistently regardless of how Apache httpd is started. (Cabalistic and fault prone procedures may work around the restriction on mapped drive letters, but this is not recommended.)

Example DocumentRoot with UNC path

DocumentRoot "//dochost/www/html/"

Case DocumentRoot with IP address in UNC path

DocumentRoot "//192.168.ane.50/docs/"

Example Alias and corresponding Directory with UNC path

Alias "/images/" "//imagehost/world wide web/images/"  <Directory "//imagehost/www/images/"> #... </Directory>

When running Apache httpd as a service, yous must create a separate account in order to access network resources, as described to a higher place.

top

Windows Tuning

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

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

Posted by: ingramlighbothe.blogspot.com

0 Response to "How To Install Apache Server In Windows 10"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel