Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

plyserve

plyserve is a production-grade Rust web server focused on ultra-high-performance WordPress workloads (static files, PHP-FPM, reverse proxy, caching) with safe runtime reloads.

Caution

This is fully vibe coded, we do not support this shit. Use on your own risk.

Install

cargo build --release
sudo install -m 0755 target/release/plyserve /usr/local/bin/plyserve

Run

Global config path (default): /etc/plyserve/plyserve.toml

Example plyserve.toml:

listeners = [
  { addr = "0.0.0.0:80", tls = false },
  { addr = "0.0.0.0:443", tls = true },
]

sites_dir = "/etc/plyserve/sites"
control_socket = "/run/plyserve/control.sock"

# Optional default TLS cert (fallback when no per-site cert matches).
[tls]
enabled = true
http2 = true
redirect_http = false
cert = "/etc/plyserve/certs/default/fullchain.pem"
key  = "/etc/plyserve/certs/default/privkey.pem"

Start server:

plyserve

Site config

/etc/plyserve/sites/example.com.toml:

server_names = ["example.com", "www.example.com"]
root = "/var/www/example/public"
listen = [80, 443]
index = ["index.php", "index.html"]

php_fpm = "unix:/run/php/php8.3-fpm-example.sock"
uploads_php = false

[static_cache]
enabled = true

[tls]
enabled = true
cert = "/etc/plyserve/certs/example/fullchain.pem"
key  = "/etc/plyserve/certs/example/privkey.pem"

[[proxy]]
path_prefix = "/api"
upstreams = ["http://127.0.0.1:9001"]
websocket = true

WordPress setup

  • Put WordPress in root.
  • Ensure php_fpm points to the correct pool socket.
  • plyserve serves static files directly, then falls back to /index.php.
  • PHP execution in wp-content/uploads is disabled by default.

PHP-FPM sockets

Prefer Unix sockets for lower overhead. Example pool config:

listen = /run/php/php8.3-fpm-example.sock
listen.owner = www-data
listen.group = www-data

TLS integration

plyserve uses rustls with SNI selection from per-site TLS configs. Certs are loaded from disk. You can point cert/key at certbot or acme.sh output. Reloads are safe via control socket.

Control socket

Unix socket: /run/plyserve/control.sock

Commands (JSON per line):

  • reload_all_sites
  • reload_site { server_name }
  • add_site { site_config }
  • update_site { site_config }
  • remove_site { server_name }
  • purge_cache { host, path_prefix }
  • stats

CLI helper:

plyserve ctl reload-all
plyserve ctl reload-site example.com
plyserve ctl add-site /etc/plyserve/sites/example.com.toml
plyserve ctl update-site /etc/plyserve/sites/example.com.toml
plyserve ctl remove-site example.com
plyserve ctl purge-cache example.com /
plyserve ctl stats

Benchmarking guide

  • Use wrk or wrk2 for HTTP/1.1 and h2load for HTTP/2.
  • Test with and without PHP to validate FastCGI path.
  • Validate cache hit rates with repeated GET/HEAD requests.

Example:

wrk -t8 -c256 -d30s http://127.0.0.1:8080/

Notes

  • Listening sockets never close during reloads.
  • Site configs persist to disk; hard restarts reload from /etc/plyserve/sites.
  • Observability: stats command returns counters and latency samples.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages