Available Languages: en | fr | ko Show
This document explains how to install, configure and run Apache 2.4 under Microsoft Windows. If you have questions after reviewing the documentation (and any event and error logs), you should consult the peer-supported users' mailing list. 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. Operating System RequirementsThe primary Windows platform for running Apache 2.4 is Windows 2000 or later. Always obtain and install the current service pack to avoid operating system bugs. Apache HTTP Server versions later than 2.2 will not run on any operating system earlier than Windows 2000. Downloading Apache for WindowsThe Apache HTTP Server Project itself does not provide binary releases of software, only source code. 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 can obtain a binary package from numerous binary distributions available on the Internet. Popular options for deploying Apache httpd, and, optionally, PHP and MySQL, on Microsoft Windows, include:
Customizing Apache for WindowsApache is configured by the files in the The main differences in Apache for Windows are:
Running Apache as a ServiceApache 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 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
If you need to specify the name of the service you want to install, use the following command. You have to do this if you have several different service installations of Apache on your computer. If you specify a name during the install, you have to also specify it during any other -k operation.
If you need to have specifically named configuration files for different services, you must use this:
If you use the first
command without any special parameters except Removing an Apache service is easy. Just use:
The specific Apache service to be uninstalled can be specified by using:
Normal starting, restarting and shutting down of an Apache service is usually done via the Apache Service Monitor, by using commands like
You can control an Apache service by its command line switches, too. To start an installed Apache service you'll use this:
To stop an Apache service via the command line switches, use this:
or
You can also restart a running service and force it to reread its configuration file by using:
By default, all Apache services are registered to run as the system user (the Never grant any network privileges to the It is recommended that users create a separate account for running Apache service(s). If you have to access network resources via Apache, this is required.
It is usually a good
practice to grant the user the Apache service runs as read and execute (RX) access to the whole Apache2.4 directory, except the If you allow the account to log in as a user and as a service, then you can log on with that account and test that the account has the privileges to execute the scripts, read the web pages, and that you can start Apache in a console 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 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 Control Manager. For example, if you try to start Apache by using the Services applet in the Windows Control Panel, you may get the following message:
You will get this generic error if there is any problem with starting the Apache service. In order to see what is really causing the problem you should follow the instructions for Running Apache for Windows from the Command Prompt. If you are having problems with the service, it 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. Running Apache as a Console ApplicationRunning Apache as a service is usually the recommended way 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 as a console application, use the following command:
Apache will execute, and will remain running until it is stopped by pressing Control-C. You can also run Apache via the shortcut Start Apache in Console placed to If Apache is running as a service, you can tell it to stop by opening another console window and entering:
Running as a service should be preferred over running in a console window because this lets Apache end any current operations and clean up gracefully. But if the server is running in a console window, you can only stop it by pressing Control-C in the same window. You can 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 press Control-Break in the console window you used for starting Apache, or enter
if the server is running as a service. Note for people familiar with the Unix version of Apache: these commands provide a Windows equivalent to 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
Then wait for Apache to stop, or press Control-C. Then enter the following:
When working with Apache it is important to know how it will find the configuration file. You can specify a configuration file on the command line in two ways:
In both of these cases, the proper If you don't specify a configuration file with
Apache will then try to determine its
If you did not do a binary install, Apache will in some scenarios complain about the missing registry key. This warning can be ignored if the server was otherwise able to find its configuration file. The value of this key is the Testing the InstallationAfter starting Apache (either in a console window or as a service) it will be listening on port 80 (unless you changed the
Apache should respond with a welcome page and you should see "It Works!". If nothing happens or you get an error, look in the
If you happen to be running Apache on an alternate port, you need to explicitly put that in the URL:
Once your basic installation is working, you should configure it properly by editing the files in the Because Apache cannot share the same 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, some firewall implementations, and even some client applications (such as Skype) which will use port 80 to attempt to bypass firewall issues. Configuring Access to Network ResourcesAccess to files over the network can be specified using two mechanisms provided by Windows: Mapped drive letterse.g.,Alias "/images/" "Z:/" UNC pathse.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. However, these mappings are associated only with interactive sessions and are not directly available to Apache httpd when it is started as a service. Use only UNC paths for network resources in httpd.conf so that the resources can be accessed consistently regardless of how Apache httpd is started. (Arcane and error prone procedures may work around the restriction on mapped drive letters, but this is not recommended.) Example DocumentRoot with UNC pathDocumentRoot "//dochost/www/html/" Example DocumentRoot with IP address in UNC pathDocumentRoot "//192.168.1.50/docs/" Example Alias and corresponding Directory with UNC pathAlias "/images/" "//imagehost/www/images/" <Directory "//imagehost/www/images/"> #... </Directory> When running Apache httpd as a service, you must create a separate account in order to access network resources, as described above. Windows Tuning
How to add Active Directory in server 2022?On the Select server roles page, click Active Directory Domain Services, then on the Add Roles and Features Wizard dialog box, click Add Features, and then click Next. On the Select features page, select any additional features you want to install and click Next.
How to Install Active Directory on Windows Server?Install the Active Directory Domain Services role
Server Manager should open by default. If it doesn't, click the Start menu and find Server Manager in the list of installed apps and click it. In Server Manager, click the Manage menu in the top-right corner and select Add Roles and Features from the menu.
What's new in Active Directory domain Services for Windows Server 2022?The new security capabilities in Windows Server 2022 combine other security capabilities in Windows Server across multiple areas to provide defense-in-depth protection against advanced threats. Advanced multi-layer security in Windows Server 2022 provides the comprehensive protection that servers need today.
How to configure DNS server in Windows Server 2022?Installation Information. Open Server Manager. To open Server Manager, click Start, and then click Server Manager.. Under Roles Summary, click Add Roles.. On Before You Begin, click Next.. On Confirm Installation Selections, click Install.. On DNS Server, click Next.. On Installation Results, click Close.. |