# Hosting

URL: https://rustpress.witsberry.com/hosting/

> Put a RustPress site online: Linux with systemd and HTTPS, Docker, Render, Railway, Fly.io, shared hosting with FastCGI, Windows and macOS.

RustPress is one program, `rp` (`rp.exe` on Windows). It contains the web server, the admin, the default theme and the plugin SDKs, and SQLite is built in, so you don’t need Rust, PHP, a web server or a database server to run a site. This page shows where it runs and how to set each option up.

## Where can I host it?

| Where                                                                                | Works?                                                                                | How                               |
| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------- | --------------------------------- |
| Your own server or a VPS (Hostinger VPS, DigitalOcean, Hetzner, AWS EC2, Lightsail…) | **Yes, everything**                                                                   | [A Linux server](#server)         |
| Docker anywhere                                                                      | **Yes, everything**                                                                   | [Docker](#docker)                 |
| Render, Railway, Fly.io (with a disk or volume)                                      | **Yes, everything**                                                                   | [Container platforms](#platforms) |
| DigitalOcean App Platform, or any platform without a disk                            | Yes, with limits: outside database and media storage, themes and plugins in the image | [Container platforms](#platforms) |
| Shared hosting (Hostinger, cPanel, Plesk, DirectAdmin…)                              | Yes, with limits: FastCGI is fast, plain CGI has fewer features                       | [Shared hosting](#shared)         |
| AWS Lambda, Google Cloud Run                                                         | Partly: untested, no background work between requests                                 | [Serverless](#serverless)         |
| Cloudflare Workers, Vercel or Netlify functions                                      | No, not for the site itself                                                           | [Cloudflare](#cloudflare)         |

To download `rp` and run the setup wizard first, see [Install and update](/install-and-update/).

## A Linux server with systemd

A small VPS is enough: 1 CPU and 512 MB of memory run a typical site comfortably. These steps are for Ubuntu, Debian, Fedora, Rocky and similar. RustPress listens on the server itself, and a reverse proxy in front of it serves the public domain over HTTPS.

### Install the program and a site folder

```
sudo useradd --system --home /srv/mysite --create-home rustpress
sudo install -d -o rustpress -g rustpress /opt/rustpress
sudo install -m 755 -o rustpress -g rustpress rp /opt/rustpress/rp
sudo ln -s /opt/rustpress/rp /usr/local/bin/rp
```

The program lives in a folder owned by the `rustpress` user, so **Dashboard › Updates** can update it from the admin. If you keep it root-owned instead, updates still work, but only from the shell with `sudo rp update`.

### Run it as a service

Create `/etc/systemd/system/rustpress.service`:

```
[Unit]
Description=RustPress
After=network-online.target
Wants=network-online.target

[Service]
User=rustpress
WorkingDirectory=/srv/mysite
ExecStart=/opt/rustpress/rp serve --root /srv/mysite --listen 127.0.0.1:8080
# `systemctl reload rustpress` restarts without dropping a request
ExecReload=/bin/kill -USR2 $MAINPID
Restart=on-failure
# Optional: Environment=RP_DATABASE_URL=mysql://user:password@127.0.0.1:3306/rustpress

[Install]
WantedBy=multi-user.target
```

```
sudo systemctl daemon-reload
sudo systemctl enable --now rustpress
sudo systemctl status rustpress        # should say "active (running)"
journalctl -u rustpress -f             # the log
sudo systemctl reload rustpress        # restart without downtime
```

Scheduled posts, email, cron events and plugins’ background jobs run inside the server, so no cron job is needed. See [Background jobs](/background-jobs/).

### HTTPS with Caddy (easiest)

Caddy gets and renews certificates by itself. Point your domain’s DNS at the server, put this in `/etc/caddy/Caddyfile`, then run `sudo systemctl reload caddy`:

```
example.com {
    reverse_proxy 127.0.0.1:8080
}
```

### HTTPS with nginx

```
server {
    listen 80;
    server_name example.com;
    client_max_body_size 256m;               # largest upload

    location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_read_timeout 300s;             # AI agents and big imports take a while
    }
}
```

Add a certificate with `sudo certbot --nginx -d example.com`, then run the setup wizard at `https://example.com/rp-admin/install`. RustPress takes visitors’ real addresses from `X-Forwarded-For` only when the proxy runs on the same machine (see `trusted_proxies` in [Configuration](/configuration/)).

### Firewall

```
sudo ufw allow OpenSSH && sudo ufw allow 80,443/tcp && sudo ufw enable
```

Keep `--listen 127.0.0.1:…` so RustPress itself isn’t exposed directly; only the proxy needs to be reachable.

## Docker

The repository has a `Dockerfile` that builds RustPress from source into a small image running `rp serve`. Everything the site keeps (settings, the SQLite database, uploads, themes, plugins, logs) is in `/data`, so give that folder a persistent volume:

```
docker build -t rustpress .
docker run -d --name mysite -p 127.0.0.1:8080:8080 -v mysite:/data \
  -e RP_SECRET_KEY=$(openssl rand -hex 32) --restart unless-stopped rustpress
```

Put Caddy or nginx in front for HTTPS as above. `docker exec mysite rp update` switches the running container over without downtime, but a recreated container starts from its image again, so rebuild the image to keep an update. The site in the volume is kept.

## Container platforms

Render, Railway, Fly.io and DigitalOcean build the `Dockerfile` from your copy of the repository and give you HTTPS. RustPress reads its settings from the environment there:

| Variable             | What it does                                                                                          |
| -------------------- | ----------------------------------------------------------------------------------------------------- |
| `PORT`               | Set by the platform; RustPress listens on `0.0.0.0:$PORT`                                             |
| `RP_SECRET_KEY`      | **Set it** (64 random characters, e.g. `openssl rand -hex 32`): keeps people logged in across deploys |
| `RP_DATABASE_URL`    | An outside database; without it, SQLite in `/data`                                                    |
| `RP_TRUSTED_PROXIES` | `private` (already set in the image): real visitor addresses come from the platform’s load balancer   |
| `RP_CACHE_URL`       | Optional Redis or Valkey (Render Key Value, Railway Redis, Upstash…)                                  |

| Platform                  | Config                         | Disk             | Steps                                                                                                                                            |
| ------------------------- | ------------------------------ | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| Render                    | `deploy/render/render.yaml`    | Yes (paid plans) | New › Blueprint › your repository. The blueprint adds a 5 GB disk at `/data` and generates `RP_SECRET_KEY`.                                      |
| Railway                   | `deploy/railway/railway.json`  | Yes (volumes)    | New project › Deploy from GitHub; add a Volume at `/data`; add `RP_SECRET_KEY`.                                                                  |
| Fly.io                    | `deploy/fly/fly.toml`          | Yes (volumes)    | `fly volumes create rustpress_data --size 3`, `fly secrets set RP_SECRET_KEY=$(openssl rand -hex 32)`, `fly deploy --config deploy/fly/fly.toml` |
| DigitalOcean App Platform | `deploy/digitalocean/app.yaml` | No               | Needs an outside database and media storage (below).                                                                                             |

*   **First visit:** the setup wizard asks for a one-time setup key, printed in the platform’s logs at start, so nobody else can claim a new site.
*   Run **one instance** with a disk. For several instances, use an outside database, Redis or Valkey (`RP_CACHE_URL`) and S3 or R2 media storage, and install themes and plugins in the image.
*   **Outside databases** (Neon, Supabase, Render, Railway, DigitalOcean PostgreSQL; PlanetScale or Aiven MySQL): paste their URL into `RP_DATABASE_URL`. `?sslmode=require` encrypts, `?sslmode=verify-full` also checks the certificate. MySQL also accepts `?ssl-mode=REQUIRED`.
*   **Platforms without a disk** throw the container’s files away on every deploy: the database must be outside, uploads must go to S3, R2 or Spaces with a media storage plugin, themes and plugins must be in the image, and logs and AI chats start empty after a restart.

## Serverless (AWS Lambda, Cloud Run)

Not tested. A container platform that keeps RustPress running (App Runner, ECS/Fargate, Cloud Run with minimum instances 1, plus an outside database and storage) works like the platforms above. Functions that start per request can serve pages, but background work (scheduled tasks, AI agents, email retries) only runs during a request: schedule `/rp-cron` with EventBridge and keep AI work on another host.

## Cloudflare

Cloudflare Workers can’t run RustPress itself: they are small functions with no files and no background work, and RustPress is a full server. What works well:

*   **Cloudflare in front of RustPress:** DNS, HTTPS, edge caching and attack protection. **Settings › Speed** sets it up: how long Cloudflare may keep pages, a zone ID and API token so every change purges Cloudflare’s cache, and the Cache Rule to paste into Cloudflare. Without that rule every page passes through to your server. Set `trusted_proxies` to Cloudflare’s ranges (or `private` behind a tunnel).
*   **Cloudflare R2** for media, with an S3-compatible media storage plugin.
*   **Headless:** the public site on Cloudflare Pages or Workers, RustPress for the admin and API. See [Headless and REST API](/headless-and-rest-api/).

## Shared hosting (FastCGI and CGI)

Shared hosting runs your files through a web server you can’t configure (usually Apache or LiteSpeed) and doesn’t let your own programs keep running. RustPress runs there as `rp cgi`, started by the web server:

*   **FastCGI** (Apache mod\_fcgid, LiteSpeed, nginx, Caddy): the web server keeps RustPress running and one process answers many requests. As fast as `rp serve`: measured at about 80,000 cached pages a second behind nginx, and about 1 ms per page through Apache. Most shared hosts have it.
*   **CGI** (any host with cgi-bin): a new RustPress for every request. Still quick: about 6 ms for a cached page and 12 ms for a new one; each PHP plugin call adds about 25 ms.

`rp cgi` picks the right one by itself, and `rp cgi-setup` writes what’s needed.

### Steps

1.  **Check you have SSH** (hPanel › Advanced › SSH Access on Hostinger; “Terminal” in cPanel).
2.  **Upload `rp`** (the Linux x86\_64 build; ARM servers: aarch64) to your home folder, not into `public_html`: `mkdir -p ~/rustpress && mv rp-linux-x86_64 ~/rustpress/rp && chmod +x ~/rustpress/rp`
3.  **Make the site folder next to `public_html`**, never inside it, and write the web files: `~/rustpress/rp cgi-setup --public ~/public_html --root ~/rustpress/site`. This writes two tiny start scripts, an `.htaccess` that sends every address to RustPress, and links the uploads folder so images are served from disk. An existing `.htaccess` is kept and the new one saved as `.htaccess.rustpress` (`--force` replaces it).
4.  **Open your domain**: the setup wizard starts. Pick SQLite or your host’s MySQL database (create it in the panel first).
5.  **Add a cron job** every minute (every 5 if your host allows no less) with the command `rp cgi-setup` printed, such as `* * * * * /home/you/rustpress/rp cron run --root /home/you/rustpress/site >/dev/null 2>&1`. Hosts that only allow web requests: `curl -fsS https://your-domain/rp-cron`.

**Updating:** Dashboard › Updates works as usual, or `~/rustpress/rp update` over SSH. Running FastCGI processes finish their requests and the web server starts the new version.

### What works on shared hosting

|                                                                 | FastCGI                       | Plain CGI                         | Instead                           |
| --------------------------------------------------------------- | ----------------------------- | --------------------------------- | --------------------------------- |
| Pages, admin, REST API, editor, media, comments, users, imports | Yes                           | Yes                               |                                   |
| Page cache                                                      | Yes (memory and files)        | Yes (files)                       | Add Redis if your host has it     |
| JavaScript and WebAssembly plugins                              | Yes                           | Yes                               |                                   |
| PHP plugins                                                     | Yes (kept running)            | Yes, slower                       | Prefer JavaScript plugins on CGI  |
| Node, Python or other service plugins (`http`)                  | Yes, while the process lives  | No                                | A `js` version, or a VPS          |
| Scheduled tasks and email queue                                 | Yes                           | After visits or with the cron job | Add the cron job                  |
| AI agents with API providers                                    | Yes                           | Yes                               |                                   |
| AI agents through Claude Code CLI                               | Only if installed on the host | Same                              | Use an API key provider           |
| Building Rust plugins, Tailwind builds                          | Usually not / usually yes     | Same                              | Build on your computer and upload |
| Updates without downtime                                        | Yes                           | Yes                               |                                   |

Your host may limit how long a background process runs (some stop long AI chats; send a message to continue) and how many processes you may have at once (heavy traffic on plain CGI; FastCGI uses one).

### Build on your computer, publish to the host

*   **Themes and plugins:** Export a .zip on your computer and Upload it on the host, or use `rp theme export` / `rp plugin export` and `rp theme install` / `rp plugin install`.
*   **Content:** Tools › Export on your computer, Tools › Import on the host.
*   **Everything:** `rp backup` makes one zip of every theme and plugin.

On a server of your own you can also use FastCGI with nginx, Caddy or IIS: run `rp cgi --root /srv/site --fcgi-listen 127.0.0.1:9000` as a service and point the web server at it. `rp serve` behind a reverse proxy is simpler and just as fast.

## Windows and macOS servers

**Windows:** run `rp.exe serve --root C:\sites\mysite --listen 127.0.0.1:8080`. To start it with the machine, use NSSM (`nssm install RustPress C:\rustpress\rp.exe serve --root C:\sites\mysite --listen 127.0.0.1:8080`) or Task Scheduler. Use IIS with Application Request Routing, or Caddy for Windows, as the HTTPS front. Updates take effect when the service restarts, in a few seconds.

**macOS:** run it with `launchd`. Save this as `~/Library/LaunchAgents/com.rustpress.mysite.plist` and load it with `launchctl load`. Updates switch over without downtime, as on Linux.

```
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"><dict>
  <key>Label</key><string>com.rustpress.mysite</string>
  <key>ProgramArguments</key><array>
    <string>/usr/local/bin/rp</string><string>serve</string>
    <string>--root</string><string>/Users/you/sites/mysite</string>
    <string>--listen</string><string>127.0.0.1:8080</string>
  </array>
  <key>RunAtLoad</key><true/>
  <key>KeepAlive</key><true/>
</dict></plist>
```

## Several sites on one server

One `rp` program can run any number of sites, each with its own folder, port and service. With a systemd template, `/etc/systemd/system/rustpress@.service`:

```
[Unit]
Description=RustPress site %i
After=network-online.target

[Service]
User=rustpress
WorkingDirectory=/srv/%i
ExecStart=/opt/rustpress/rp serve --root /srv/%i
ExecReload=/bin/kill -USR2 $MAINPID
Restart=on-failure

[Install]
WantedBy=multi-user.target
```

Give each site its own `listen` port in its `rp-config.toml` (8080, 8081…), run `sudo systemctl enable --now rustpress@shop rustpress@blog`, and add one Caddy or nginx block per domain. One `rp update` switches every site over. Several sites can also share one MySQL or PostgreSQL database with different `table_prefix` values.

Next: [Running a site](/running-a-site/) covers email, backups, logs, security and troubleshooting.
