OA0 = Omni AI 0
OA0 是一个探索 AI 的论坛
现在注册
已注册用户请  登录
OA0  ›  技能包  ›  tailscale-serve:管理 Tailscale Serve 服务的命令行工具

tailscale-serve:管理 Tailscale Serve 服务的命令行工具

 
  branch ·  2026-02-15 20:12:11 · 3 次点击  · 0 条评论  

Tailscale Serve 使用技巧

使用 tailscale serve 管理多个路径,避免冲突。

核心命令

查看当前服务状态

tailscale serve status

在指定路径提供目录或文件服务

# 目录
tailscale serve --bg --set-path /slides /path/to/directory

# 单个文件
tailscale serve --bg --set-path /presentation /path/to/file.html

# 端口(用于运行中的服务)
tailscale serve --bg --set-path /api http://localhost:8080

在根路径提供端口服务(会替换所有现有服务)

tailscale serve --bg 8888

移除特定路径

tailscale serve --https=443 /slides off

重置所有服务

tailscale serve reset

重要说明

  • 路径冲突:/ 路径提供服务会覆盖所有其他路径
  • 后台模式: 使用 --bg 参数保持服务持续运行
  • 多路径支持: 可同时在不同路径提供多个服务
  • 先查状态: 添加新路径前,务必先运行 tailscale serve status

常用模式

在控制界面旁提供演示文稿服务

# 若控制界面位于 /,则在子路径提供演示文稿
tailscale serve --bg --set-path /slides ~/clawd/personal-agents-presentation.html

# 访问地址:https://[主机名].ts.net/slides

提供多个目录服务

tailscale serve --bg --set-path /docs ~/documents
tailscale serve --bg --set-path /slides ~/presentations
tailscale serve --bg --set-path /files ~/files

提供本地开发服务器服务

tailscale serve --bg --set-path /app http://localhost:3000

操作流程

  1. 检查当前状态:tailscale serve status
  2. 选择未使用的路径(如 /slides/docs/api
  3. 使用 --set-path /your-path /source 启动服务
  4. 再次运行 tailscale serve status 验证
  5. 分享完整 URL:https://[主机名].ts.net/your-path

故障排除

“无法访问服务内容”
- 检查 tailscale serve status —— 服务是否在预期路径?
- 是否有其他服务覆盖了根路径 /

“想用端口服务替换所有现有服务”

tailscale serve reset
tailscale serve --bg 8888

“想在现有配置上添加新服务”

# 不要使用 reset!直接用 --set-path 添加
tailscale serve --bg --set-path /newpath /source
3 次点击  ∙  0 人收藏  
登录后收藏  
目前尚无回复
0 条回复
About   ·   Help   ·    
OA0 - Omni AI 0 一个探索 AI 的社区
沪ICP备2024103595号-2
Developed with Cursor