Deploy Caddy
A static website with automatic HTTPS using a Caddy web server.
Just deployed
Deploy and Host Caddy on Railway
Caddy is an open-source web server. It is written in Go and runs as one static binary. Caddy serves static files, operates as a reverse proxy, and can get TLS certificates automatically.
About Hosting Caddy
This template deploys a static website with Caddy from the alphasecio/caddy-server GitHub repository. The site/ directory contains the website files. The Caddyfile contains the server configuration. Railway supplies HTTPS for your Railway domain and your custom domains. Caddy receives plain HTTP from the Railway edge, so you do not need to configure TLS certificates. To change the website, replace the files in site/ and push the changes to your repository.
Common Use Cases
- Static websites: Serve HTML, CSS, images, and fonts with one small configuration file.
- Landing pages and portfolios: Deploy a fast personal website or project page without a web framework.
- Reverse proxy: Change the
Caddyfileto send requests to other services in your Railway project.
Dependencies for Caddy Hosting
Deployment Dependencies
Implementation Details
The template uses the official Caddy 2 Docker image based on Alpine Linux. The configuration does these tasks:
- Listens on the port in the
PORTvariable. Railway sets this variable automatically. - Serves the files that the
Dockerfilecopies fromsite/into the image. - Compresses responses with zstd and gzip.
- Adds basic security headers to all responses.
- Disables the Caddy admin API.
- Runs Caddy as a non-root user.
For the full configuration, refer to the Caddyfile and the Dockerfile.
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
