Chapter 7 — Operations and Administration
7.1 Command line
| Flag | Purpose |
|---|---|
-c <path> |
Configuration file; defaults to ./conf/wxserver.toml, then /etc/wxserver/wxserver.toml |
-w <dir> |
Workdir; anchors relative pid/logs/run/html paths |
-t |
Validate configuration syntax and semantics only |
-s reload / stop / quit |
Signal the PID: SIGHUP reloads, SIGTERM stops gracefully (control files on Windows) |
--service install|uninstall|start|stop|restart|status |
System service management (auto-detects the platform manager) |
--reset-password [password] |
Reset console password; empty = random. Add --manager-user with multiple users |
--reset-totp |
Delete the console TOTP configuration |
-no-manager |
Disable the console for this run |
-v |
Show the version |
wxserver -c /etc/wxserver/wxserver.toml
wxserver -t -c /etc/wxserver/wxserver.toml
wxserver -s reload -c /etc/wxserver/wxserver.toml
wxserver -s stop -c /etc/wxserver/wxserver.toml
wxserver --service install -c /etc/wxserver/wxserver.toml
wxserver --service start -c /etc/wxserver/wxserver.toml
wxserver --service status -c /etc/wxserver/wxserver.toml
Companion tools: wxserver-tool htpasswd (bcrypt entries), wxserver-tool
bench (ab-style load test) and wxserver-convert (server config / CRS rules
to TOML).
For a portable Windows deployment, wxserver.exe with -w "C:\WxServer"
and -c conf\wxserver.toml anchors relative paths. The service account is
an ordinary local user.
7.2 System services
The service name is always wxserver; --service install auto-detects the
platform manager:
| Platform | Manager | Install location |
|---|---|---|
| Linux | systemd → OpenRC → SysV, auto-detected | /etc/systemd/system or /etc/init.d |
| FreeBSD | rc.d (daemon(8)) |
/usr/local/etc/rc.d |
| macOS | launchd | /Library/LaunchDaemons |
| Windows | SCM | registered with sc create |
--service install writes and registers the definition;
start/stop/restart/status forward to the platform manager (SCM
service mode on Windows). Without a service manager, fall back to the
PID-file + -s reload|stop|quit mode.
7.3 Reload and shutdown
-s reload, or “Save and reload” in the console, atomically swaps the
running configuration (arc-swap) without dropping the management API.
Listener address changes require a restart. Invalid configuration fails
the reload; the old configuration keeps serving.
-s stop and -s quit are equivalent: SIGTERM is sent and in-flight
requests get up to graceful_timeout_sec (default 30 s) to finish. With
multiple workers the master forwards signals to each worker.
Schedule a maintenance window when changing
user,worker_processesor the listener port range. Changing only sites, WAF or cache settings can be hot-reloaded.
7.4 Logs and rotation
Logs live under /var/log/wxserver/ by default:
access.$year-$month-$day.log (combined format), error.log, waf.log,
stream.log, manager-login.log and manager-audit.log. Paths accept
$year/$month/$day.
max_size_mb and max_backups control size and retention. Access logs are
redacted by default; encrypt = true encrypts every line with
AES-256-GCM. Read encrypted logs from the console log page or
GET /api/logs/{name}, which decrypts server-side.
7.5 Backup and account recovery
Back up conf/ (including vhost/, certs/, manager.toml, acme.toml
and cert.toml) and the site html/. run/ holds the PID file, shared
memory and, if configured there, the cache; it need not be backed up. When
upgrading, replace the binary, validate with -t, reload, and back up
config before a major version.
Reset a lost password with wxserver --reset-password [password] (add
--manager-user with multiple users) and a lost authenticator with
--reset-totp; both touch only manager.toml or the TOTP state file.
Changes hot-reload, and old tokens are invalidated only when the credentials
actually change.
7.6 Config and rule conversion (wxserver-convert)
# nginx -> TOML (file mode expands includes; no -out writes stdout)
wxserver-convert -from nginx -in nginx.conf -out conf/wxserver.toml
# nginx -> main config + one conf/vhost/*.toml per site
wxserver-convert -from nginx -in nginx.conf -out conf/wxserver.toml --split-vhosts conf/vhost
# Apache .htaccess -> paste-ready location fragment (.htaccess auto-detected)
wxserver-convert -in .htaccess --prefix /blog/ -out /tmp/blog.toml
# OWASP CRS / ModSecurity -> TOML (multiple -in merge)
wxserver-convert -from crs -in crs-setup.conf -in rules/*.conf -out conf/waf/crs.toml
--split-vhostsnames sites by explicitnameor the firstdomain; when a domain has both 80⁄443 sites the plain one becomes<domain>-http; the target directory must live inside the main config directory.- Unsupported directives print
warning:lines to stderr (-quietsilences) without aborting; output is TOML-parsed before writing. - nginx highlights:
gzip*is written per level;set_real_ip_from/real_ip_headermap to[modules.http_realip](real_ip_recursive on→mode="recursive");ssl_cipherskeeps only rustls-supported AEAD suites;image_filter resize|crop→type="image"+default_mode;valid_referers+if ($invalid_referer)→referer;add_header ... always→add_headers_always;log_format→access_log.format_template; named locations andtry_files ... @namecarry over; commonifsubsets become structuredif.
7.7 wxserver-tool
# htpasswd: bcrypt entries into a 0600 file; interactive mode hides input
wxserver-tool htpasswd -f conf/htpasswd # interactive
wxserver-tool htpasswd -f conf/htpasswd -u alice -p 'secret'
wxserver-tool htpasswd --check -f conf/htpasswd -u alice -p 'secret'
# bench: ab-style load test, prints RPS and P50/P90/P99 latencies
wxserver-tool bench http://127.0.0.1:8080/ -n 1000 -c 50
wxserver-tool bench http://127.0.0.1:8080/api -n 200 -c 10 -m POST -H 'Content-Type: application/json' -d '{"x":1}'
wxserver-tool bench https://self-signed.local/ -n 50 -c 5 -k # skip TLS verify
# toml: TOML 1.1 -> JSON (python tomllib cannot read multiline inline tables)
wxserver-tool toml conf/wxserver.toml # to JSON
wxserver-tool toml --rewrite conf/vhost/example.toml # normalize in place (keeps comments)
# precompress: generate .gz/.br/.zst sidecars
wxserver-tool precompress --dir html