|
1 | 1 | --- |
2 | | -title: Deploying FrankenPHP in production with Docker Compose |
3 | | -description: Deploy a PHP application to production with FrankenPHP and Docker Compose on a single Linux server, including TLS, reverse proxy, and multi-node setups. |
| 2 | +title: Deploying FrankenPHP in production |
| 3 | +description: Deploy a PHP application to production with FrankenPHP and Docker Compose on a single Linux server, including TLS, reverse proxy, and multi-node setups, or natively on Windows. |
4 | 4 | --- |
5 | 5 |
|
6 | 6 | # Deploying in production |
@@ -171,3 +171,48 @@ which can cause issues like incorrect HTTPS detection or wrong client IP address |
171 | 171 | If you want to deploy your app on a cluster of machines, you can use [Docker Swarm](https://docs.docker.com/engine/swarm/stack-deploy/), |
172 | 172 | which is compatible with the provided Compose files. |
173 | 173 | To deploy on Kubernetes, take a look at [the Helm chart provided with API Platform](https://api-platform.com/docs/deployment/kubernetes/), which uses FrankenPHP. |
| 174 | + |
| 175 | +## Deploying on Windows |
| 176 | + |
| 177 | +FrankenPHP runs natively on Windows, with full support for [the worker mode](worker.md) and [hot reloading](hot-reload.md). |
| 178 | + |
| 179 | +To install it, run this in PowerShell: |
| 180 | + |
| 181 | +```powershell |
| 182 | +irm https://frankenphp.dev/install.ps1 | iex |
| 183 | +``` |
| 184 | + |
| 185 | +Alternatively, [download the Windows archive from the releases page](https://github.com/php/frankenphp/releases). |
| 186 | +It contains the FrankenPHP executable as well as the official PHP binary for Windows. |
| 187 | + |
| 188 | +To run FrankenPHP in the background and start it automatically at boot, register it as a Windows service. |
| 189 | +As [recommended by the Caddy documentation](https://caddyserver.com/docs/running#windows-service), use [WinSW](https://github.com/winsw/winsw): |
| 190 | + |
| 191 | +1. Download [the latest version of WinSW](https://github.com/winsw/winsw/releases) as `frankenphp-service.exe` in the directory containing `frankenphp.exe` |
| 192 | +2. In the same directory, create a `frankenphp-service.xml` file: |
| 193 | + |
| 194 | + ```xml |
| 195 | + <service> |
| 196 | + <id>frankenphp</id> |
| 197 | + <name>FrankenPHP</name> |
| 198 | + <description>The modern PHP app server (https://frankenphp.dev)</description> |
| 199 | + <executable>%BASE%\frankenphp.exe</executable> |
| 200 | + <arguments>run --config %BASE%\Caddyfile</arguments> |
| 201 | + <log mode="roll-by-time"> |
| 202 | + <pattern>yyyy-MM-dd</pattern> |
| 203 | + </log> |
| 204 | + </service> |
| 205 | + ``` |
| 206 | + |
| 207 | +3. Install and start the service: |
| 208 | + |
| 209 | + ```powershell |
| 210 | + .\frankenphp-service.exe install |
| 211 | + .\frankenphp-service.exe start |
| 212 | + ``` |
| 213 | + |
| 214 | +Windows services cannot be reloaded. To apply configuration changes gracefully, without restarting the service, run: |
| 215 | + |
| 216 | +```powershell |
| 217 | +.\frankenphp.exe reload --config Caddyfile |
| 218 | +``` |
0 commit comments