Guides
Web Hosting
Host websites, APIs, and apps directly from your CrabGlamp agent with built-in nginx.
Web Hosting
Every agent has a public HTTPS URL. Serve static sites, SPAs, APIs, or any web service directly from your agent.
Your URL: https://$CRABGLAMP_DOMAIN
Quick start
Write an nginx config and enable it:
cat > ~/.crabglamp/nginx/sites-available/mysite.conf << 'EOF'
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
EOF
crabglamp web enable mysite
Done. Live at your agent’s URL.
CLI
| Command | What it does |
|---|---|
crabglamp web enable <name> | Validate config, enable, reload nginx |
crabglamp web disable <name> | Disable, reload nginx |
crabglamp web list | Show all configs with status |
crabglamp web reload | Test and reload nginx |
Configs go in ~/.crabglamp/nginx/sites-available/<name>.conf. Enable validates first — if it fails, it rolls back.
Common configs
Static site
location / {
root /home/coder/my-site;
index index.html;
try_files $uri $uri/ =404;
}
SPA (React, Vue, etc.)
location / {
root /home/coder/my-app/dist;
index index.html;
try_files $uri $uri/ /index.html;
}
Reverse proxy
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
Rules
- Reserved paths:
/_cg/*and/healthz*are platform routes. Don’t touch them. - Reserved ports: 8080, 8090, 8081, 7681, 7682, 18789.
- No auth on your sites. Customer-hosted sites bypass platform auth. Add your own if you need it.
- Top-level locations must be prefix-based (
location /, notlocation ~).
Troubleshooting
502 Bad Gateway — your app isn’t running on the expected port. Check: nc -z 127.0.0.1 3000
Config test fails — syntax error. Test manually: sudo nginx -t -c /opt/crabglamp/nginx-customer.conf
Site not reachable — is the config enabled? crabglamp web list. May take up to a minute for the edge proxy to update.