Keep Apache HTTP Windows Service running 24/7 with Service Protector

How to Keep the Apache HTTP Windows Service Running 24/7 with Service Protector

Automatically restart your Apache web server when it crashes or stops serving pages. Achieve 100% uptime for your web applications today!

The Apache HTTP Server is the Internet's most popular web server.


To protect Apache with Service Protector:

  1. Download, install and configure the Apache web server, if necessary.

  2. Download and install Service Protector, if necessary.

  3. Start Service Protector.

  4. Select Protector > Add to open the Add Protector window:

    Add Protector

  5. On the General tab:

    • In the Service to protect field, choose the Apache windows service. This will be named ApacheX.Y, where X.Y represents the software's version number. Since we have installed Apache version 2.2.22, our service is named Apache2.2

      You will notice a green circle on the left if the Apache service is already running, as pictured below.

    Apache Windows Service: General Tab

  6. Click over to the Monitor tab, where we will set up a failure detection script to tell Service Protector when Apache has failed and is not serving pages.

    1. Follow these instructions to create the failure detection BAT file. We have called ours check-web-server.bat and placed it in a folder called C:\ApacheTools.

    2. Click the "..." button in the Whenever it fails a "sanity check" section and specify the full path to the batch file.

      Note that the default of having Service Protector check your web server every 30 seconds should be fine but please feel free to increase the timing if you suspect that checking so often will generate too much load on your server. (Of course, increasing that time will impact the failure detection and recovery cycle...)

    Apache Windows Service: Monitor Tab

  7. Click the Save >> button. In a couple of seconds, an entry for Apache will show up in the Service Protector window. Apache is probably already running but it is not yet being protected by Service Protector (as pictured below).

    Apache Windows Service: Created

  8. To start protection, choose Protector > Start "Apache2.2". The shield icon will go to green to indicate that Apache is being protected:

    Apache Windows Service: Running

  9. That's it! Next time your computer boots, Apache will start and Service Protector will begin monitoring the service to promptly restart it if it fails.

    We encourage you to edit Apache in Service Protector and check out the many other settings that may be appropriate for your environment. For example, send an email when the service fails, restart Apache periodically to keep performance snappy, and much more.



Trouble protecting the Apache Windows Service?