How to Keep the Apache HTTP Windows Service Running 24/7 with Service Protector
Automatically restart your Apache web server whenever it crashes or stops serving pages. Add a local health check to achieve 100% uptime for your web applications today
Select Protector > Add to open the Add Protector window:
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 installed Apache version 2.4.69, the service is named Apache2.4 on our machine:
Next, let's set up a web server health check.
With that in place, Service Protector will restart Apache if it ever stops serving pages.
Switch to the Monitor tab. Check the Whenever it fails a periodic sanity check box and click the Set button:
In the Add Sanity Check window, select the Check that a web server is responding properly
option and click Next to proceed:
Enter the URL that Service Protector should monitor. This could be a dedicated health check address or anything else you think is appropriate.
Both HTTP and HTTPS are supported.
We kept it simple by checking the root page (http://localhost):
Click Next to continue.
Specify how often Service Protector should fetch the URL.
The default of every 5 minutes should be fine but you can check more often if you like.
After you're done, click Next to move on:
And finally, confirm your settings:
If everything looks good, click Add
to record your new sanity check and return to the Monitor tab.
Click the Save button. In a couple of seconds, an entry for Apache will show up in the Service Protector window.
The green shield indicates that Service Protector is already babysitting Apache:
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, recycle Apache periodically to keep performance snappy, and much more.
Trouble protecting the Apache Windows Service?
From Service Protector, select Protector > Report Activity > Today to bring up an HTML report detailing the interaction between Service Protector and Apache.
Browse the Service Protector FAQ for answers to commonly asked questions and troubleshooting tips.