diff --git a/src/docs/markdown/install.md b/src/docs/markdown/install.md index 9278f8e..2ed8c77 100644 --- a/src/docs/markdown/install.md +++ b/src/docs/markdown/install.md @@ -29,6 +29,7 @@ This page describes various methods for installing Caddy on your system. - [Ansible](#ansible) - [Scoop](#scoop) - [Termux](#termux) +- [Windows service](#windows-service) ## Static binaries @@ -223,3 +224,51 @@ _Note: This is a community-maintained installation method._ [**View the Termux build.sh file**](https://github.com/termux/termux-packages/blob/master/packages/caddy/build.sh) + +## Windows service + +_Note: This is a community-maintained installation method._ + +Install Caddy as a service on Windows with these instructions. + +**Requirements:** + +- `caddy.exe` binary that you [downloaded](/download) or [built from source](/docs/build) +- Any exe from the latest release of the + [WinSW](https://github.com/winsw/winsw/releases/latest) service wrapper (Stay + on a v2.x release for now) + +Put all files into a service directory. In the following examples, we use `c:\caddy`. + +Rename the WinSW exe file to `caddy-service.exe`. + +Add a `caddy-service.xml` in the directory: + +
<service>
+  <id>caddy</id>
+  <!-- Display name of the service -->
+  <name>Caddy Web Server (powered by WinSW)</name>
+  <!-- Service description -->
+  <description>Caddy Web Server (https://caddyserver.com/)</description>
+  <executable>%BASE%\caddy.exe</executable>
+  <arguments>run</arguments>
+  <log mode="roll-by-time">
+    <pattern>yyyy-MM-dd</pattern>
+  </log>
+</service>
+
+ +You can now install the service using: +
caddy-service install
+ +You might want to start the Windows Services Console to see if the service is runnnig correctly: +
services.msc
+ +Be aware that Windows services cannot be reloaded, so you have to tell caddy directly to relaod: +
caddy reload
+ +Restarting is possible via the normal Windows services commands. + +For customizing the service wrapper, see the [WinSW documentation](https://github.com/winsw/winsw/tree/master#usage) + +