Setup Caddy as a Windows Service with AlwaysUp

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:

  1. Download and install AlwaysUp, if necessary.

  2. 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 is 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"

  3. Start AlwaysUp.

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

    Add Application

  5. 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.

    Caddy Windows Service: General Tab

  6. 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.

    1. 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.

    2. 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...

    Caddy Windows Service: Monitor Tab

  7. 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.

    Caddy Windows Service: Startup Tab

  8. 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.

    Caddy Windows Service: Created

  9. 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).

    Caddy Windows Service: Running

  10. 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!

Download & Try it Free!

Download AlwaysUp and Run as a Service Today! Version 10.0

4.6 MB Installer
  • Unrestricted 30-day trial for new users; upgrade for existing users
  • For Windows 10/8.1/8/7 and Windows Server 2016/2012 R2/2008/2003
  • How to Install | EULA
Our customers include...


Compatible with Windows 10 (32 & 64-bit)

Windows Server 2012 Certified (32 & 64-bit)

Windows 8 Compatible (32 & 64-bit)

Compatible with Windows 7 (32 & 64-bit)

Works with Windows Server 2008 R2 (32 & 64-bit)



Over 73,000 installations, and counting!
 
AlwaysUp is number 1! Run as a Service with AlwaysUp

Rock-solid for the past 12+ years!