# Rust web app hosting: how to deploy an axum or Actix Web app

> A Rust web app is one release binary that binds 0.0.0.0 on the port it is given and shuts down on SIGTERM. The hard part is the build: a first release build takes minutes, so the host must keep its cache. On Livops you push a repository with Cargo.toml, it is built with cargo build --release and runs as a web app for 39 credits a month (39,000 so'm).

Source: https://livops.dev/en/hosting/rust-hosting

By Livops team, the people who build and run Livops. Updated 20 November 2026.

A Rust web server is small and fast once it is running; getting it running is where hosting differs. The release build of a real axum or Actix Web app takes minutes, most of it compiling dependencies, so a host that throws its cache away makes every deploy that slow. This page covers what a Rust web app needs in production — binding, shutdown, build profile, binary size — compares where to run one with each provider's own prices, and ends with exactly what Livops does with a `Cargo.toml`.

## What does a Rust web app need in production?

### An address of 0.0.0.0 and the port from the environment

Read `PORT` and bind `0.0.0.0` on it. Actix Web's own example binds `127.0.0.1`, and `bind` fails if the socket is already in use by another program[2]; in a container, `127.0.0.1` means nobody outside can reach you.

### A shutdown that finishes requests

axum's `with_graceful_shutdown` takes a future you write and starts the shutdown when it completes[1]: catching SIGTERM is your code's job. Actix Web handles signals itself: SIGTERM shuts its workers down gracefully, SIGINT and SIGQUIT force them, and the workers have 30 seconds by default, changed with `shutdown_timeout()`[2]. Keep that shorter than the host's own stop window.

An axum 0.8 server[1], with both:

```rust
use axum::{routing::get, Router};
use tokio::signal::unix::{signal, SignalKind};

#[tokio::main]
async fn main() {
    let app = Router::new().route("/healthz", get(|| async { "ok" }));

    let port: u16 = std::env::var("PORT").ok().and_then(|p| p.parse().ok()).unwrap_or(3000);
    let listener = tokio::net::TcpListener::bind(("0.0.0.0", port)).await.unwrap();

    axum::serve(listener, app)
        .with_graceful_shutdown(async {
            let mut term = signal(SignalKind::terminate()).unwrap();
            tokio::select! {
                _ = term.recv() => {},
                _ = tokio::signal::ctrl_c() => {},
            }
        })
        .await
        .unwrap();
}
```

The same in Actix Web, with the shutdown window shortened:

```rust
HttpServer::new(|| App::new().route("/healthz", web::get().to(|| async { "ok" })))
    .bind(("0.0.0.0", port))?
    .shutdown_timeout(20)
    .run()
    .await
```

### The right number of workers

Actix Web starts one worker per physical CPU in the system unless `workers()` says otherwise[2]. On a server you share, that may be more workers than the share of the machine you are given; set it.

### A release build, and a smaller binary

`cargo build --release` uses the release profile: `opt-level = 3`, no debug info, `strip = "none"`, `lto = false`, `codegen-units = 16`[3]. Three settings make the binary smaller or faster in exchange for build time: `strip = true` removes symbols[3]; `lto` optimises across crates at the cost of longer linking[3]; fewer `codegen-units` means less of a crate is compiled in parallel, which may make the code faster and the build slower[3].

```toml
[profile.release]
strip = true
lto = "thin"
```

### A small image, if you build one

In a Docker image, a multi-stage build compiles in the Rust image and copies only the binary into the final one, leaving every build tool behind[4]. The final image needs whatever the binary links at run time — the C library it was built against, and CA certificates for an app that calls HTTPS APIs.

### Configuration and a database

Secrets and settings belong in environment variables; data that must outlive a restart belongs in a database, whose address is best read from a variable such as `DATABASE_URL`.

## The options at a glance

| Option | What it is | Smallest paid always-on process | What you still maintain |
| --- | --- | --- | --- |
| Livops | A platform; servers in Uzbekistan | 39 credits (39,000 so'm) a month | Your code |
| A VPS in Uzbekistan | A virtual machine with root | 82,000 so'm a month: 1 vCPU, 2 GB, 30 GB HDD (SmartCloud)[5] | The system, the build, a systemd unit, a reverse proxy, HTTPS |
| Render | A platform with native Rust builds | $7 a month: 0.5 CPU, 512 MB[6] | Your code |
| Railway | A platform billed by usage | Hobby: $5 a month, including $5 of usage[8] | Your code |
| Fly.io | Virtual machines billed by the second | $2.19 a month: shared-cpu-1x, 256 MB[9] | Your code, and its Docker image |
| DigitalOcean App Platform | A platform with container instances | $5 a month: 1 shared vCPU, 512 MiB[10] | Your code |

Other providers' prices are from each provider's own page, read on 20 November 2026; the dates are in Sources below. Livops prices are the ones the cabinet bills today.

## Each option

### Livops

A `Cargo.toml` is enough: the release build runs on Livops's servers with the compiled dependencies cached per project, and the binary runs as a web app with an address and HTTPS. Payment is in so'm through Payme or Click, Uzbekistan's payment services; the servers are in Uzbekistan, close to users there and farther from users elsewhere. You get no root, one app's memory stops at 2 GB, and a single build may not run longer than ten minutes.

### A VPS

82,000 so'm a month buys SmartCloud's cheapest 2 GB machine[5]. Either the server compiles, and needs the toolchain and the memory for it, or you build elsewhere and copy the binary up — and then it has to match the server's system. After that it is one systemd unit, plus HTTPS, a proxy and the updates.

### Render

Render lists Rust among its native runtimes, beside custom Docker containers[6]. The smallest paid web service is $7 a month for 0.5 CPU and 512 MB[6], and web services have a free instance type[7].

### Railway

The Hobby plan is $5 a month, with $5 of usage included and always-on services; memory is about $10 per GB a month and CPU about $20 per vCPU a month, billed by the second[8]. Plans are paid by card[8].

### Fly.io

The smallest machine is $2.19 a month for shared-cpu-1x and 256 MB, billed by the second[9] — the lowest dollar price in this table. A personal organisation's bill under $5 a month is waived[9].

### DigitalOcean App Platform

$5 a month buys a fixed shared instance with 1 vCPU, 512 MiB and 50 GiB of outbound transfer, limited to one container instance[10].

## Build where, run where?

The real trade-off for Rust is where the compile happens. Building on the server needs memory and a cache that survives between deploys; building in CI needs a binary, or an image, that matches the machine it will run on — which is what [exec format error](https://livops.dev/en/guides/error-docker-exec-format) is about when it does not. A platform that builds from your repository and keeps the cache, as Livops does, removes both problems at the cost of the build minutes. A VPS keeps everything in your hands, including the toolchain updates.

## Where can you host a Rust app for free?

- **Livops** has no free tier for apps. On an account that has not paid yet, the first bot or app runs for 15 minutes on a zero balance, once. Static sites are free.
- **Render** gives each workspace 750 free instance hours a month; a free web service spins down after 15 minutes without inbound traffic and takes about a minute to start again[7].
- **Railway** has a Free plan with $1 of usage a month, up to 1 vCPU and 0.5 GB per service, that sleeps after 5 to 10 minutes without outbound traffic; a trial gives $5 for 30 days with no card[8].
- **Fly.io** has no free tier for new organisations: a $1 trial for 7 days, and a personal bill under $5 a month is waived[9].
- **DigitalOcean App Platform** is free for up to 3 static sites only[10].

## Rust hosting on Livops

1. In the cabinet, create a project from a GitHub repository, or upload the folder or a `.zip` (`target/` is left out of uploads). For a monorepo, set the folder the crate is in.
2. Put settings and secrets under **Variables**. For a database, add PostgreSQL under **Databases**; `DATABASE_URL` is written into the app's variables by itself.
3. Deploy. The log shows `cargo fetch`, the compile and the start.

What Livops does with a repository that has `Cargo.toml` at its root and no `Dockerfile`:

- **Install:** `cargo fetch`.
- **Build:** `cargo build --release`, into the project's cache, which keeps the compiled dependencies for the next build. A Rust web app takes 8 to 9 minutes on its first build and about a minute after a code change. If cargo fails, its error is the last thing in the log.
- **The binary:** the one named after the package in `Cargo.toml`, or the one executable the release build left. It is copied to `.livops/bin/app` and `target/` is removed, so the release is the program alone. A crate that builds no binary says "no binary".
- **Run:** the binary starts on its own, without the Rust toolchain beside it. After the first build it is a web app, which must answer HTTP on `PORT`; a program that opens no port should be created as a worker instead.

With a `Dockerfile` in the repository, the Dockerfile builds it; see [Docker hosting](https://livops.dev/en/hosting/docker-hosting). To name a health path or a size, put `livops.json` in the root:

```json
{
  "kind": "web",
  "healthPath": "/healthz",
  "memory": 256
}
```

When it runs:

- **The environment** has `PORT` (3000 unless you change it).
- **On a new push**, the new binary has a minute to answer on `PORT` — on `healthPath` with 2xx or 3xx, if you set one — before traffic moves to it. The old one keeps running 15 seconds for requests in flight, then gets SIGTERM and 30 seconds. If the new one never answers, the old one keeps serving.
- **If it crashes** it is started again; ten crashes inside 15 minutes and it is stopped, and you are told with its last lines.
- **Builds** may run for ten minutes. One that runs out continues from the cache on the next deploy.
- **Memory:** one CPU and 384 MB by default, or 256, 512, 1024 or 2048 MB; the size is part of what you pay for.
- **Files** written to `/app/data` (the `DATA_DIR` variable) survive deploys; `/tmp` does not.

A web app is **39 credits a month (39,000 so'm)**. One credit is 1,000 so'm; see [Pricing](https://livops.dev/en/docs/pricing).

## Questions

**Do I need a Dockerfile to deploy Rust on Livops?**

No. A Cargo.toml at the root is enough: Livops runs cargo fetch and cargo build --release and starts the binary. If the repository has a Dockerfile, that builds it instead.

**Which binary does Livops start?**

The one named after the package in Cargo.toml. If there is none by that name, the one executable the release build left. It is copied out of target/, which is then removed, so the release is the program alone.

**How long does a Rust build take on Livops?**

A Rust web app takes 8 to 9 minutes on its first build and about a minute after a code change, because the compiled dependencies stay in the project's cache. A build may run for ten minutes; if one runs out of time, deploy again and it continues where it stopped.

**Which address should an axum or Actix app bind?**

0.0.0.0 and the port in the PORT variable, 3000 unless you change it. 127.0.0.1, which many examples use, is reachable only from inside the container.

**Does Actix Web's graceful shutdown work on Livops?**

Yes. A replaced version gets SIGTERM, which Actix treats as a graceful shutdown, and then 30 seconds. Actix waits 30 seconds by default too, so set shutdown_timeout a little lower, for example 20.

**How much does a Rust app cost on Livops?**

39 credits a month, 39,000 so'm at 1,000 so'm a credit. There is no free tier for apps; the first app on an account that has not paid runs for 15 minutes on a zero balance, once.

## Sources

1. [axum — Serve (docs.rs)](https://docs.rs/axum/latest/axum/serve/struct.Serve.html). Checked 20 November 2026.
2. [Actix Web — HTTP server](https://actix.rs/docs/server). Checked 20 November 2026.
3. [Cargo — Profiles](https://doc.rust-lang.org/cargo/reference/profiles.html). Checked 20 November 2026.
4. [Docker — Multi-stage builds](https://docs.docker.com/build/building/multi-stage/). Checked 20 November 2026.
5. [SmartCloud — VDS plans](https://smartcloud.uz/cloud-services/vds/). Checked 20 November 2026.
6. [Render — Pricing](https://render.com/pricing). Checked 20 November 2026.
7. [Render — Deploy for free](https://render.com/docs/free). Checked 20 November 2026.
8. [Railway — Pricing](https://railway.com/pricing). Checked 20 November 2026.
9. [Fly.io — Pricing](https://docs.fly.io/about/pricing). Checked 20 November 2026.
10. [DigitalOcean — App Platform pricing](https://www.digitalocean.com/pricing/app-platform). Checked 20 November 2026.
