🦀 CrabGlamp Docs

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 — no external hosting needed.

Your URL: https://$CRABGLAMP_DOMAIN


Quick setup

  1. Write an nginx config in ~/.crabglamp/nginx/sites-available/:
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
  1. Enable it:
crabglamp web enable mysite

Done. Your app is live at your agent’s public URL.


CLI

crabglamp web enable <name>    # Enable a site config
crabglamp web disable <name>   # Disable a site config
crabglamp web list             # List all configs with status
crabglamp web reload           # Test and reload nginx

Enable validates the config, symlinks it to sites-enabled/, and reloads nginx. If the config test fails, it rolls back automatically.


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 use them.
  • Reserved ports: 8080, 8090, 8081, 7681, 7682, 18789 (platform services).
  • No auth on your sites. Customer-hosted sites bypass platform auth. Add your own if needed.
  • Top-level locations must be prefix-based (location /, not location ~).

Troubleshooting

502 Bad Gateway — Your app isn’t running on the expected port. Check with 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 — Verify config is enabled (crabglamp web list). May take up to a minute for edge proxy to update.