Install
openclaw skills install static-webhostDeploy static web pages and apps via Caddy or Nginx (auto-detected). Use when: 通过 Caddy 或 Nginx 部署静态网页和应用(自动检测)。使用场景: (1) User asks to create a web page, demo, or static site and make it accessible / 用户要求创建网页并可访问 (2) User asks to host/deploy HTML, JS, CSS files / 用户要求托管部署静态文件 (3) User says "做个网页"、"部署一下"、"让我能访问" (4) Need to serve any static content over HTTP / 需要通过 HTTP 提供任何静态内容。 Supports both Caddy and Nginx — auto-detects which is installed and running. 同时支持 Caddy 和 Nginx,自动检测当前系统安装的 Web 服务器。 NOT for / 不适用于:dynamic backends, APIs, or reverse proxy configuration. ⚠️ **权限声明 / Privilege Requirements:** 此 skill 需要 **sudo/root 权限** 才能执行系统级操作(写入 /var/www/html、修改 Web 服务器配置、重启服务)。
openclaw skills install static-webhostAuthor: Serein-213
Deploy static files to Caddy or Nginx. Auto-detects which server is available.
此 skill 执行的操作需要 elevated privileges(sudo/root),属于高危操作。
/var/www/html/(Web 根目录)/etc/nginx/ 或 /etc/caddy/Caddyfilesystemctl reload nginx/caddypacman -S / apt install(如需要安装 Web 服务器)# Nginx 配置备份
sudo cp -r /etc/nginx /etc/nginx.backup.$(date +%Y%m%d_%H%M%S)
# Caddy 配置备份
sudo cp /etc/caddy/Caddyfile /etc/caddy/Caddyfile.backup.$(date +%Y%m%d_%H%M%S)
# Web 根目录备份(如已有内容)
sudo cp -r /var/www/html /var/www/html.backup.$(date +%Y%m%d_%H%M%S)
如果不需要系统级部署,考虑:
python3 -m http.server 8080npx serve ./publicBefore deploying, detect which web server is installed and running:
# Check Caddy
command -v caddy && systemctl is-active caddy 2>/dev/null
# Check Nginx
command -v nginx && systemctl is-active nginx 2>/dev/null
Priority: Caddy (if both are running) > Nginx > Neither (prompt user to install one).
Ensure Caddyfile has a static file block. Add if missing:
:80 {
handle_path /r/* {
file_server {
root /var/www/html
}
}
}
Then systemctl reload caddy.
mkdir -p /var/www/html/<project-name>
cp -r <source-files> /var/www/html/<project-name>/
URL: http://<ip>/r/<project-name>/index.html
No reload needed — files are served instantly.
Create a location block in the Nginx site config (e.g. /etc/nginx/sites-available/default or /etc/nginx/conf.d/static.conf):
server {
listen 80;
# ... existing config ...
location /r/ {
alias /var/www/html/;
autoindex off;
try_files $uri $uri/ =404;
}
}
Then nginx -t && systemctl reload nginx.
mkdir -p /var/www/html/<project-name>
cp -r <source-files> /var/www/html/<project-name>/
URL: http://<ip>/r/<project-name>/index.html
No reload needed — files are served instantly once placed in web root.
# Tailscale
tailscale ip -4 2>/dev/null
# Or local IP
hostname -I | awk '{print $1}'
curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:80/r/<project-name>/index.html
Expect 200.
/var/www/html/ (shared convention for both Caddy and Nginx)http://<ip>/r/<subdir>/ (consistent across both servers)index.html existspacman -S caddy / apt install caddy / apt install nginx