Shared hosting (CGI and FastCGI)
Deploy on Apache-style shared hosting where you cannot run a long-lived process.
Many shared plans cannot keep a daemon running. HydroGo has two compatibility modes for them, at the cost of some performance. Use a VPS if you can; use these when you cannot.
Build for the host
Cross-compile a static, CGO-free linux/amd64 binary (shared hosts have no C toolchain):
make build-hosting # Linux and macOS
# Windows: scripts/build-hosting.ps1CGI mode
CGI starts a fresh process for each request, so there are no resident workers. The wrapper script is what Apache executes; keep the binary and config.yaml outside the document root (for example a sibling private/ folder).
#!/bin/sh
exec /path/to/private/hydro serve --cgi --config /path/to/private/config.yaml- Upload
hydro.cgithrough SFTP or the panel's upload function, not by pasting into an in-panel text editor. Files created in a panel can get different ownership and failsuexecchecks withPermission denied. - Add
DirectoryIndex hydro.cgito.htaccess. Without it, a request for/may return 403 once any placeholderindex.htmlis gone. - Apache serves existing files directly and sends everything else to HydroGo.
- Scheduled news jobs run in bounded batches during public requests.
Running migrate without SSH
If you have no shell, a one-shot CGI script can run hydro migrate. Protect it with a long random token, return 404 on mismatch, and delete it right after use.
migrate.cgi immediately after migration finishes.#!/bin/sh
TOKEN="<random-hex>"
case "$QUERY_STRING" in
token=$TOKEN)
echo "Content-Type: text/plain"; echo ""
/path/to/private/hydro migrate --config /path/to/private/config.yaml 2>&1
;;
*)
echo "Status: 404 Not Found"; echo "Content-Type: text/plain"; echo ""; echo "not found"
;;
esacFastCGI mode
FastCGI is a long-running responder: start it under the provider's process manager and point Apache's FastCGI integration at the loopback address. The port is not bound to public interfaces.
hydro serve --fastcgi --fastcgi-address 127.0.0.1:9001HydroGo keeps its bounded background workers in this mode and drains requests on shutdown. The full guide, including .htaccess examples and the static page cache that lets Apache answer eligible public pages without starting CGI, is in deploy/hosting/README.md.