What I’m using nginx for
Besides a few random side project I no longer maintain, I’ll typically use nginx as a reverse proxy for apps with their own web engine. For C# that uses kestral and this site that’s written in go that uses fiber v2, I don’t have much need for a lot of services you might typically offload onto a web server like static file serving. What I do need however, is location routing (e.g. subdomain[1-3].site.com), compression, ip restrictions, and ssl termination via letsencrypt.
What’s pingap
Cloudflare has this proxy library built in rust called pingora, pingap is built on top of pingora to provide a lot of the plumbing around configuration and process management that you’d expect in nginx. Being built in rust, pingora/pingap is blazing fast and has a few nice features like an admin web interface and automatic config reloading.
Setup
For my setup, I took these steps:
- Install pingap from the repo’s install script onto my linux proxy server
- Setup a configuration directory and relevant config files for my setup
- Create a systemd service unit
- Disable the nginx service and enable the pingap service
My configuration looked like this:
./pingap/conf/
basic.toml -- basic process configs like threads and keepalive pool size
certificates.toml -- my letsencrypt key setup (letsencrypt manages its own lifecycle)
locations.toml -- configuration various web services and the domains that use them
plugins.toml -- pingap plugins for things such as compression
servers.https.toml -- similar to nginx servers, but combined into a single file that aggregates/enables the locations
servers.http.toml -- same, but http
upstreams.toml -- config info for location upstream info (the ips)
It’s a much cleaner configuration then having to symlink sites around in nginx and a lot less duplication of various configurations. Very happy so far with how it’s running. This may be my goto reverse proxy solution from here on.
