Install Apache as a Service on Windows

Today I share how you can install the Apache webserver as a Windows service.

Why install Apache as a service?

By installing Apache as a service you are able to have it start automatically on boot.

In addition to this, running Apache as a windows service allows you to easily restart it. When running as a service you can monitor the program through the services panel in Windows.

Installing Apache as a Windows Service

To install Apache as a service you need to use an admin command prompt. This can be opened by typing cmd in the search bar and right clicking it to select “Run as administrator”.

Once the command window is open you need to cd into the bin directory of the apache folder. This is the folder that holds httpd.exe.

To install the service with the default name, run the following command.

httpd.exe -k install

By default, for Apache 2.4 this will a service with the name “Apache2.4”.

To install the service with a custom name, use the -n flag. In the below example I have called my service “Apache HTTP Server”

httpd.exe -k install -n "Apache HTTP Server"

Using these commands you can install Apache as a Windows service to help manage it and run at start up.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.