[← All integrations](/getting-started)
Install · Verified
# Nginx (VPS) — keep Nginx (sidecar)
static shell · sidecar
Have an established Nginx config (TLS, rate limits, multi-vhost) you don't want to redo? Run Node on :3000 and proxy from Nginx — let the snippet handle static-vs-HTML routing.
**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 have an established Nginx config (TLS, rate limits, multi-vhost) you don't want to throw away. Run the Node server on `127.0.0.1:3000` and proxy every request from Nginx to it — let the snippet handle static-vs-HTML routing on the Node side.
/etc/systemd/system/yoursite-agentsite.servicecopy
```
# /etc/systemd/system/yoursite-agentsite.service
[Unit]
Description=yoursite agentsite sidecar
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=3000
Environment=DIST_DIR=/srv/yoursite/dist
Environment=AGENTSITE_SITE=https://yoursite.com
EnvironmentFile=/etc/yoursite/agentsite.env # AGENTSITE_TOKEN=asit_…
[Install]
WantedBy=multi-user.target
```
/etc/nginx/sites-available/yoursitecopy
```
# /etc/nginx/sites-available/yoursite
server {
listen 443 ssl http2;
server_name yoursite.com;
# TLS, rate limits, basic auth, etc. all stay in Nginx.
# Hand every request to the Node sidecar — let agentsite decide
# what is a static asset vs an HTML route. Don't try_files {} here;
# the sidecar's express.static will serve dist/ directly.
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_read_timeout 30s;
}
}
```
**Don't keep `try_files` in the vhost.** The snippet's `express.static` already serves `dist/`; if Nginx also tries to serve it from disk you'll get inconsistent caching and `/llms.txt` / `/.well-known/*` routes won't resolve.
[← 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