|
How to Setup the Caddy Web Server as a Windows Service |
Automatically start Caddy web services whenever your machine boots. No need to log on first!
Caddy is a secure, easy-to-use web server written entirely in Go.
To install Caddy as a Windows Service with AlwaysUp:
-
Download and install AlwaysUp, if necessary.
-
Download and setup Caddy, if necessary.
Note the command line you run to launch Caddy -- we'll be using that with AlwaysUp.
Note that we expanded the zip file to C:\Caddy and that location is used throughout this tutorial.
Here's the command line that worked for our simple situation:
C:\Caddy\Caddy.exe -agree -log "C:\Caddy\caddy.log" -ca "C:\Caddy\certs" -root "C:\WWW\htdocs"
-
Start AlwaysUp.
-
Select Application > Add to open the Add Application window:
-
On the General tab:
-
In the Application field, enter the full path to the Caddy executable, caddy.exe.
Since we installed Caddy in C:\Caddy, we'll specify:
C:\Caddy\Caddy.exe
-
In the Arguments field, enter all the parameters to the Caddy executable.
For our installation, we'll specify:
-agree -log "C:\Caddy\caddy.log" -ca "C:\Caddy\certs" -root "C:\WWW\htdocs"
Be sure to fully quote each file and folder name that contains a space!
-
And in the Name field, enter the name that you will call this application in AlwaysUp.
We've stuck with the default, Caddy.
-
If you are interested in monitoring Caddy and detecting when it stops serving pages,
click over to the Monitor tab. We'll set up a failure detection batch file to tell AlwaysUp when the Web Server has failed.
-
Follow these instructions to create the failure detection BAT file.
We have called ours check-web-server.bat and placed it in the AlwaysUp folder, C:\Program Files (x86)\AlwaysUp.
-
Click the "..." button in the Whenever it fails a "sanity check" section and specify the full path to the batch file.
Change the Every controls to 5 minutes, or tune to any frequency that you see fit. More time means less frequent checks and less load on the server, but the sensitivity to failures is reduced...
-
Click over to the Startup tab and check the Ensure that the Windows Networking components have started box.
This informs AlwaysUp that Caddy needs the regular TCP/IP networking stack to operate.
-
We're now done configuring AlwaysUp, so click the Save button. In a couple of seconds, an application called Caddy (or whatever you called it) will show up in the AlwaysUp window.
It is not yet running though and the state will be Stopped.
-
To start Caddy, choose Application > Start "Caddy". The state should transition to Running after a few seconds and Caddy should be available on its configured port (2015 by default).
-
That's it! Next time your computer boots, your Caddy service will be launched immediately, before anyone logs on.
Feel free to edit the entry in AlwaysUp and add more advanced options. For example, boost the priority of the Caddy process, send an email if the web server fails, and much more.
Caddy not working properly as a Windows Service?
-
Visit the AlwaysUp Troubleshooter - our online tool that can help you resolve the most common problems encountered when
running an application as a windows service.
-
From AlwaysUp, select Application > Report Activity > Today... to bring up a HTML report detailing the interaction between AlwaysUp and your application.
The AlwaysUp Event Log Messages page explains the more obscure messages.
- Consult the AlwaysUp FAQ for answers to commonly asked questions and troubleshooting tips.
- Contact us and we will be happy to help!
|
Over 94,000 installations, and counting!
|
|
|
Rock-solid for the past 19+ years!
|
Fully Compatible with 160+ Applications...
|