> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vers.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Static web app

> Deploy a static web app to a Vers VM with nginx

Deploy a simple static website on a Vers VM using nginx. You'll create a VM, install nginx, write an HTML page, and see it live — all in a few minutes.

## Prerequisites

* Vers CLI [installed and authenticated](/installation)

## Step 1: Create the project

Create a new folder for your project if you don't already have one.

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
mkdir static-site
cd static-site
vers init
```

## Step 2: Launch the VM

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
vers run --vm-alias static-site
```

Verify it's running:

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
vers status
```

You should see your VM in a `Running` state.

## Step 3: Connect and install nginx

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
vers connect
```

Inside the VM:

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
# Set up DNS for outbound internet access
echo 'nameserver 8.8.8.8' > /etc/resolv.conf

# Install nginx
apt-get update && apt-get install -y nginx
```

## Step 4: Create your static site

Still inside the VM, replace the default nginx page with your own HTML:

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
cat > /var/www/html/index.html << 'EOF'
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>My Vers Site</title>
  <style>
    * { margin: 0; padding: 0; box-sizing: border-box; }
    body {
      font-family: system-ui, -apple-system, sans-serif;
      display: flex;
      justify-content: center;
      align-items: center;
      min-height: 100vh;
      background: #0a0a0a;
      color: #fafafa;
    }
    .container {
      text-align: center;
      padding: 2rem;
    }
    h1 { font-size: 3rem; margin-bottom: 1rem; }
    p { font-size: 1.25rem; color: #888; }
  </style>
</head>
<body>
  <div class="container">
    <h1>Hello from Vers</h1>
    <p>This static site is running on a Vers VM with nginx.</p>
  </div>
</body>
</html>
EOF
```

## Step 5: Start nginx and verify

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
# Start nginx
systemctl start nginx

# Verify it's serving your page
curl -s http://localhost | head -5
```

You should see the first few lines of your HTML. Now exit the VM:

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
exit
```

## Step 6: View it in your browser

Your site is live at:

```
https://<vm-id>.vm.vers.sh
```

Replace `<vm-id>` with your VM's ID (shown in `vers status`). Vers terminates TLS at the proxy, so your VM serves plain HTTP but browsers see HTTPS — no cert setup needed.

<Info>
  If your VM ID is `vm-abc123`, the URL would be `https://vm-abc123.vm.vers.sh`. Port 80 is one of the [default routed ports](/vm-access#available-ports).
</Info>

## Step 7: Make a change

Connect back to the VM and update the page:

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
vers connect
```

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
sed -i 's/Hello from Vers/My Static Site is Live/' /var/www/html/index.html
```

Refresh your browser — the change is instant. No build step, no deploy pipeline. Exit when done:

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
exit
```

## What you learned

* Creating a Vers VM and connecting via SSH
* Installing and running nginx inside a VM
* Serving a static HTML page accessible over HTTPS
* Making live edits to a running site

## Next steps

* [Static web app (GitHub import)](/examples/static-web-app-github) — pull a repo instead of writing HTML by hand
* [Basic web app](/examples/basic-web-app) — add a backend with Node.js or Python
* [Accessing your instance](/vm-access) — networking, ports, and SSH details
