Windows server support
This commit is contained in:
@@ -1060,6 +1060,84 @@ or the root domain:
|
||||
}
|
||||
```
|
||||
|
||||
## Windows service
|
||||
ntfy can run as a Windows service, allowing it to start automatically on boot and run in the background.
|
||||
ntfy automatically detects when it is running as a Windows service and adjusts its behavior accordingly.
|
||||
|
||||
### Installing the service
|
||||
To install ntfy as a Windows service, open an **Administrator** command prompt or PowerShell and run:
|
||||
|
||||
```cmd
|
||||
sc create ntfy binPath= "C:\path\to\ntfy.exe serve" start= auto
|
||||
```
|
||||
|
||||
!!! note
|
||||
Make sure to replace `C:\path\to\ntfy.exe` with the actual path to your ntfy executable.
|
||||
The spaces after `binPath=` and `start=` are required.
|
||||
|
||||
You can also specify a config file:
|
||||
|
||||
```cmd
|
||||
sc create ntfy binPath= "C:\path\to\ntfy.exe serve --config C:\ProgramData\ntfy\server.yml" start= auto
|
||||
```
|
||||
|
||||
### Starting and stopping
|
||||
To start the service:
|
||||
|
||||
```cmd
|
||||
sc start ntfy
|
||||
```
|
||||
|
||||
To stop the service:
|
||||
|
||||
```cmd
|
||||
sc stop ntfy
|
||||
```
|
||||
|
||||
To check the service status:
|
||||
|
||||
```cmd
|
||||
sc query ntfy
|
||||
```
|
||||
|
||||
### Configuring the service
|
||||
The default configuration file location on Windows is `%ProgramData%\ntfy\server.yml` (typically `C:\ProgramData\ntfy\server.yml`).
|
||||
Create this directory and file manually if needed.
|
||||
|
||||
Example minimal config:
|
||||
|
||||
```yaml
|
||||
base-url: "https://ntfy.example.com"
|
||||
listen-http: ":80"
|
||||
cache-file: "C:\\ProgramData\\ntfy\\cache.db"
|
||||
auth-file: "C:\\ProgramData\\ntfy\\auth.db"
|
||||
```
|
||||
|
||||
!!! warning
|
||||
Use double backslashes (`\\`) for paths in YAML files on Windows, or use forward slashes (`/`).
|
||||
|
||||
### Viewing logs
|
||||
By default, ntfy logs to stderr. When running as a Windows service, you can configure logging to a file:
|
||||
|
||||
```yaml
|
||||
log-file: "C:\\ProgramData\\ntfy\\ntfy.log"
|
||||
log-level: info
|
||||
```
|
||||
|
||||
### Removing the service
|
||||
To remove the ntfy service:
|
||||
|
||||
```cmd
|
||||
sc stop ntfy
|
||||
sc delete ntfy
|
||||
```
|
||||
|
||||
### Limitations on Windows
|
||||
When running on Windows, the following features are not available:
|
||||
|
||||
- **Unix socket listening**: The `listen-unix` option is not supported on Windows
|
||||
- **Config hot-reload**: The SIGHUP signal for hot-reloading configuration is not available on Windows; restart the service to apply config changes
|
||||
|
||||
## Firebase (FCM)
|
||||
!!! info
|
||||
Using Firebase is **optional** and only works if you modify and [build your own Android .apk](develop.md#android-app).
|
||||
|
||||
Reference in New Issue
Block a user