---
title: "Deploy Caddy"
description: "A static website with automatic HTTPS using a Caddy web server."
category: "Starters"
url: https://railway.com/deploy/caddy-starter
---

# Deploy Caddy

A static website with automatic HTTPS using a Caddy web server.

**[Deploy Caddy on Railway](https://railway.com/template/caddy-starter)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/caddy-starter/manifest.json

- **Creator:** alphasec
- **Category:** Starters
- **Total deploys:** 212

## Template content

### caddy https://raw.githubusercontent.com/caddyserver/website/07c51663ab3cf37c8831eefeb64383a10af3a4a5/src/resources/images/favicon.png

- **Source:** alphasecio/caddy-server
- **Public domain:** Yes

## Documentation

# 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](https://github.com/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 `Caddyfile` to send requests to other services in your Railway project.

## Dependencies for Caddy Hosting

- [alphasecio/caddy-server GitHub repository](https://github.com/alphasecio/caddy-server)

### Deployment Dependencies

- [Caddy documentation](https://caddyserver.com/docs/)
- [Caddyfile reference](https://caddyserver.com/docs/caddyfile)
- [How to Deploy a Static Website with Caddy on Railway](https://alphasec.io/how-to-deploy-a-static-website-with-caddy-on-railway/)

### 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 `PORT` variable. Railway sets this variable automatically.
- Serves the files that the `Dockerfile` copies from `site/` 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](https://github.com/alphasecio/caddy-server/blob/main/Caddyfile) and the [Dockerfile](https://github.com/alphasecio/caddy-server/blob/main/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.

## Similar templates

- [Openfront Gym](https://railway.com/deploy/openfront-gym) — Opensource Mindbody alternative based on Next.js and Keystone.js
- [open-excalidraw](https://railway.com/deploy/open-excalidraw) — Self-hostable collaborative drawing built on Excalidraw
- [Next.js + Prisma + PostgreSQL Starter](https://railway.com/deploy/nextjs-prisma-postgres) — Deploy a Next.js app with Prisma ORM and PostgreSQL in one click.

Open this page in a browser: https://railway.com/deploy/caddy-starter
