Deploy Caddy
A static website with automatic HTTPS using a Caddy web server.
Just deployed
Deploy and Host Caddy on Railway
Caddy is a lightweight, open-source web server written in Go that compiles to a single static binary. It serves static files, handles reverse proxying, and manages TLS certificates automatically — making it an efficient alternative to NGINX for simple web serving needs.
About Hosting Caddy
This Railway template deploys a static website using Caddy from the alphasecio/caddy-server GitHub repository. The site/ directory contains your static files (HTML, CSS, assets), and the Caddyfile configures the server. Railway handles TLS and HTTPS at the platform level, so Caddy's automatic HTTPS is intentionally disabled in the Caddyfile — no certificate configuration needed. Replace the default index.html and styles.css in site/ with your own content and redeploy.
Common Use Cases
- Static website hosting — serve HTML, CSS, and asset files over HTTPS with minimal configuration and zero runtime dependencies
- Landing pages and portfolios — deploy a fast, lightweight personal site or project page without a full web framework
- Reverse proxy — extend the Caddyfile to proxy requests to backend services running elsewhere in your Railway project
Dependencies for Caddy Hosting
Deployment Dependencies
- Caddy documentation
- Caddyfile reference
- alphasecio/caddy-server GitHub repository
- alphasec guide: How to Deploy a Static Website with Caddy on Railway
Implementation Details
The Caddyfile is configured to serve files from site/ on the port Railway injects via the PORT environment variable, with automatic HTTPS disabled (Railway handles TLS):
:{$PORT} {
root * /srv/site
file_server
encode gzip
}
To customise, fork the repository and edit the files in site/.
Why Deploy Caddy on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying Caddy on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
Template Content