[← All integrations](/getting-started)

Install · Verified

# Nginx (VPS) — replace Nginx

simplest · static shell

Already running a static site behind Nginx on a VPS? Retire Nginx and let the Node snippet bind :80 directly. systemd unit + install commands ship as deltas.

**Start here first.** Every platform recipe below assumes the canonical Express + Docker install at [/install/express-docker](/install/express-docker). The snippets on this page are the platform-specific deltas on top of that baseline.

You're running a static site behind Nginx on a VPS. The simplest path is to **retire Nginx** and let the Node server bind `:80` (or `:443` with a TLS frontend like Caddy / Traefik / Cloudflare). Same `server.mjs` + `package.json` + `agentsite.cjs` as the canonical recipe — the only deltas are the systemd unit and the install commands.

terminal — install + cut overcopy

```
# 1. Drop the snippet next to your existing dist/.
sudo mkdir -p /srv/yoursite/agentsite
sudo curl https://api.agentsite.app/snippet.js \
  -o /srv/yoursite/agentsite/agentsite.cjs

# 2. Save server.mjs + package.json into /srv/yoursite/agentsite/ (see snippets above).
sudo bash -c 'cd /srv/yoursite/agentsite && npm install --omit=dev'

# 3. Token in a root-readable env file (mode 600).
sudo install -m 600 /dev/stdin /etc/yoursite/agentsite.env <<EOF
AGENTSITE_TOKEN=asit_xxxxxxxxxxxx
EOF

# 4. Stop nginx, start the Node service on :80.
sudo systemctl stop nginx
sudo systemctl disable nginx
sudo systemctl daemon-reload
sudo systemctl enable --now yoursite
```

/etc/systemd/system/yoursite.servicecopy

```
# /etc/systemd/system/yoursite.service
[Unit]
Description=yoursite (agentsite)
After=network.target

[Service]
WorkingDirectory=/srv/yoursite/agentsite
ExecStart=/usr/bin/node /srv/yoursite/agentsite/server.mjs
Restart=always
User=www-data
Environment=NODE_ENV=production
Environment=PORT=80
Environment=DIST_DIR=/srv/yoursite/dist
Environment=AGENTSITE_SITE=https://yoursite.com
EnvironmentFile=/etc/yoursite/agentsite.env   # contains AGENTSITE_TOKEN=asit_…

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

**Binding :80 needs CAP\_NET\_BIND\_SERVICE.** On Debian/Ubuntu: `setcap 'cap_net_bind_service=+ep' $(which node)`, or run on `:3000` and front it with TLS.

[← All integrations](/getting-started#by-hand)  ·  [Need help with this recipe? →](/contact)

Cookies

We use cookies to make this site work and to understand how it's used. [Learn more](https://www.cookiesandyou.com/)

Decline Got it