# Deploy a static site

> Publish a directory of files — or a framework build — to the edge with its own HTTPS hostname

URL: https://pier.run/docs/guides/deploy-a-static-site

**Goal.** `acme`'s `www/` (an `index.html`) is served at an HTTPS hostname. A site is a
set of files served from the edge, not a container: it has no port, no plan and no
instance.

### Declare the site

```yaml title="pier.yaml"
environments:
  prod:
    sites:
      - name: www
        build_context: ./www
        targets:
          - name: primary
```

`pier apply` (or `pier deploy`) creates the site and its hostname. Files are published by
a deploy of the site itself.

### Publish the files

```bash
pier deploy www --path ./www --skip-build
```

```text title="output"
→  Building site www from ./www
→  Found 1 site files to deploy
→  All 1 files already stored — nothing to upload
→  Finalizing deploy...
OK  Deployed site "www"
Name    www
Status  active
Files   1
URL     https://6aeqkcz34yr.site.pier.run

```

`--path` is the directory to upload; `--skip-build` uploads it as it is. Without
`--skip-build`, Pier detects the framework (Next.js, Astro, Vite, Hugo, …) and runs its
build first, uploading the output directory.

```bash
pier ls sites
```

```text title="output"
                                                     
 NAME STATUS URL                                     
                                                     
 www  active https://6aeqkcz34yr.site.pier.run 
                                                     

```

## What changed

The `sites:` block above. The upload is recorded as a deploy of `www` (`pier deploys ls
www`), so `pier rollback www` returns to the previous bundle.

## Variations

* **Framework build**: `pier deploy www --path .` from a Vite or Next.js project runs
  the detected build; `--build-cmd` and `--output-dir` override what was detected, and
  `framework:`, `build_command:`, `output_dir:` on the target make it permanent.
* **Single-page app**: `spa_fallback: true` on the target serves `index.html` for unknown
  paths. Redirects, rewrites and headers are `pier routes`.
* **On push**: connect the repository; each push to the target's branch then publishes
  ([Deploy from GitHub](/docs/guides/deploy-from-github)).

## See also

[Sites](/docs/resources/sites) · [`pier deploy`](/docs/cli/reference/deploy) ·
[`pier routes`](/docs/cli/reference/routes)
