Blog · Deploy guides

How to deploy an Eleventy site in 2026: one command, HTTPS and a Dockerfile you keep

By the Pethost team · · 8 min read

You have an Eleventy site that builds on your laptop, and you want it online at an address with HTTPS. On Pethost that is one command, pethost deploy, run in the folder that has package.json. It writes the Dockerfile for you, runs your build script and serves _site. A small site made as Eleventy's first steps make one was built and started in 24 seconds the first time.

In short
  • One script: "build": "npx @11ty/eleventy" in package.json, as Eleventy's own deployment page advises.
  • One command: pethost deploy in the folder that has package.json. It writes a Dockerfile that runs the script and serves _site.
  • Clean addresses work: /about/ answers 200, /about leads to it, and an address that is no page answers 404.
  • The address: https://my-site.yourname.pethost.app, with HTTPS at once. Your own domain is one DNS record.
  • The price: €9.99 a month for a machine of 2 vCPU, 3 GB and 30 GB that runs this site and every other project you have. There is no free tier.

What you need to deploy an Eleventy site in 2026

Three things: the site, the pethost command and a Pethost account.

The site here is made as Eleventy's first steps make one, with two Markdown pages:

mkdir my-site && cd my-site
npm init -y
npm pkg set type="module"
npm install @11ty/eleventy
echo '# Heading' > index.md
echo '# About' > about.md

Add the build script. Eleventy's deployment page advises it for every host that builds the site for you, and it is how pethost knows this is an Eleventy site that is built with a command:

"scripts": {
  "build": "npx @11ty/eleventy"
}

The command is one program, installed by one line. Every command it has is in the CLI's reference.

curl -fsSL https://pethost.dev/install.sh | sh      # macOS, Linux
irm https://pethost.dev/install.ps1 | iex           # Windows, in PowerShell

The account needs a plan. If you are not signed in, pethost deploy opens your browser and signs you in. If you have no plan yet, it shows you where to choose one, and waits.

Deploy the Eleventy site with one command

Go to the folder that has package.json and run pethost deploy. This is the whole screen, for the site above:

$ cd my-site
$ pethost deploy
Name it [my-site]:    it will live at https://my-site.sam.pethost.app
✓ Packed 5 files, 55 KB   (left out node_modules)
✓ Uploaded straight to your machine
✗ /compose.yaml: the project directory has no compose.yaml at its root: add one
✓ Eleventy site detected, wrote Dockerfile.
✓ Packed 6 files, 56 KB   (left out node_modules)
✓ Uploaded straight to your machine
✓ Built and started in 24 s
  · wrote compose.yaml for the Dockerfile: the service app, reading .env, port 80
✓ app listens on 80 → https://my-site.sam.pethost.app
  It answers 200.

https://my-site.sam.pethost.app

Wrote .pethost (commit it). Next:   pethost logs -f   ·   pethost open
  1. It asks one thing The project's name, which is the first word of its address. Enter takes the folder's name.
  2. The machine finds nothing to run The folder goes straight to your machine, without node_modules. The line with the cross is its answer: a project runs from a Dockerfile or a Compose file, and the folder has neither yet.
  3. pethost writes the Dockerfile It saw @11ty/eleventy in package.json and a script that runs it, and uploads the folder again.
  4. The machine builds and starts it Then pethost asks the address itself, and prints what it answered: 200.

The file .pethost says which project this folder is. Commit it with the Dockerfile, and the next deploy asks nothing.

The Dockerfile that pethost writes for Eleventy

This is the file as it was written into the site's folder, whole:

# Written by pethost deploy for this Eleventy site: package.json builds it with "npx
# @11ty/eleventy", which writes _site, Node 24 (no .nvmrc names another), npm installs
# it (package-lock.json).
# It is yours now: change it as you like. pethost does not write it again.

FROM node:24 AS build
WORKDIR /app

COPY . .

# Every dependency: what builds the project, and may start it, is among the ones for
# development.
RUN --mount=type=cache,target=/root/.npm \
    npm install

RUN npm run build

# The site is files: Caddy serves them on port 80.
FROM caddy:2
COPY --from=build /app/_site /srv

COPY <<'EOF' /etc/caddy/Caddyfile
:80 {
	root * /srv
	# A browser that takes its answers compressed gets them so.
	encode
	# Names that begin with a dot are no pages;
	# .well-known is the one such folder that is there for visitors.
	@own {
		path */.*
		not path /.well-known/*
	}
	error @own 404
	# A page's address works without its ".html", and a folder's leads to its index.html.
	try_files {path} {path}.html {path}/
	file_server
	# An address that is no page: the site's own 404.html, if it has one.
	handle_errors 404 {
		rewrite * /404.html
		file_server
	}
}
EOF
EXPOSE 80

Its first lines say what pethost read in your folder. Three things come from there:

The second half is a small web server for _site, Eleventy's default output folder. If the machine cannot build or start the Dockerfile pethost wrote, pethost takes the file back out of your folder and says what failed.

Do Eleventy's clean addresses work?

Eleventy writes about.md to _site/about/index.html, so the page's address is /about/. We asked the deployed site what a visitor asks:

What the deployed Eleventy site answered
AddressAnswer
/200, the home page
/about/200, the page
/about308, a redirect to /about/
/nothing404

If your site has a 404.html at the root of _site, an address that is no page shows it.

Change a page and deploy again

Edit a page and run the same command. The second deploy took 4 seconds, because the machine keeps the build's layers and npm's cache:

$ pethost deploy
my-site (.pethost)
✓ Packed 7 files · uploaded · built and started in 4 s
  · wrote compose.yaml for the Dockerfile: the service app, reading .env, port 80
  · kept the project's x-pethost
  It answers 200.
https://my-site.sam.pethost.app

To build and deploy on every push instead, connect the repository once:

pethost github sam/my-site          # from now on, every push deploys itself

Pethost reads only the repositories you gave its GitHub App. If a deploy goes wrong, pethost rollback puts the version before it back, and your machine keeps the three versions before the current one. An AI agent can do all of this for you through Pethost's MCP server: how an agent deploys and looks after a project. The same command deploys a VitePress site.

Use your own domain for the site

Any name under your account's domain is an address at once, with HTTPS. A domain you own takes one command and one DNS record:

pethost domain add www.example.com

The command prints the record to make: a CNAME from your name to your machine's name. The certificate comes by itself once the name resolves, and renews itself. pethost password puts a password page in front of the whole site, for one that is not public yet.

What you get for the price

Pethost is €9.99 a month for everything you host, on 2 vCPU, 3 GB of memory and 30 GB of disk. A built Eleventy site is files behind one small web server, so the machine has room for a contact form's back end, a database and your other projects. There is no fee per project and nothing metered: the second site costs nothing more, and neither does a month with many readers.

What is already done on it: HTTPS with certificates that renew themselves, deploys from GitHub, nightly backups kept for 14 days, SSH into any container, and every request counted. The panel shows the busiest paths of the last 30 days, which for a blog is the list of posts people really read. The machine is always on, so a page never waits for a cold start. The plans are on the pricing part of the first page.

Which pages people read. A project's ten busiest paths with their share and response times, and the log of single requests.
The Pethost panel: a project's ten busiest paths with share, count and response times, and the log of single requests.

Pethost is the best pick for

  • People with a blog and something more: the Eleventy site, an app and a database on one machine, on one bill
  • Solo developers with several side projects, each with a site of its own
  • People whose agent deploys for them: Claude Code or Codex puts the site online and reads its logs
  • Small teams who want a site behind a password page until launch

Look elsewhere if

  • Your application needs several regions or autoscaling

Questions

Does an Eleventy site need a Dockerfile to deploy?

On Pethost a project runs from a Dockerfile or a Compose file, and you do not have to write it: in a folder that has neither, pethost deploy writes the Dockerfile for an Eleventy site and deploys it. The file stays in your folder, and you can change it.

Which build command does an Eleventy deploy use?

Your own build script from package.json, for example "build": "npx @11ty/eleventy". The Dockerfile runs npm run build and serves _site, Eleventy's default output folder.

Why did pethost deploy write no Dockerfile for my Eleventy site?

It writes one when package.json has @11ty/eleventy and a script that runs it. Add "build": "npx @11ty/eleventy" to the scripts and run the command again.

Can I deploy an Eleventy site from GitHub on every push?

Yes. Deploy the folder once with pethost deploy, then run pethost github owner/repository. From then on every push to the repository builds and deploys itself, and pethost rollback goes back to an earlier commit.

How do I use a custom domain with HTTPS for an Eleventy site?

Run pethost domain add www.example.com and make the one DNS record it prints, a CNAME to your machine's name. The certificate comes by itself once the name resolves, and renews itself.

What does it cost to host an Eleventy site on Pethost?

€9.99 a month for the Starter machine of 2 vCPU, 3 GB and 30 GB, with no fee per project: the same machine runs your other sites, apps and databases. There is no free tier. Prices are without VAT.

The screens are deploys of a two-page site made as Eleventy's first steps make one, with Eleventy 3.1.6 and pethost 0.2.1, on a test machine of ours that had built nothing before. The account in them is the example one, sam.

  1. Eleventy: get started
  2. Eleventy: deployment and hosting
  3. pethost, the command line of Pethost

Put your projects online today

A machine of your own, as many projects as fit, one flat price. Nothing metered, nothing billed on top.

Host all your projects for €9.99/mo