使用 Gitea + Act Runner 搭建本地工作流(无 Docker), Nginx 反向代理报错问题
使用 Gitea + Act Runner 搭建本地工作流(无 Docker)
目标:在本地服务器上以二进制文件方式搭建 Gitea,并运行 Act Runner(不使用 Docker,直接在宿主机上执行命令)。
操作系统:Debian
一、搭建 Gitea
按照官方文档创建 git 用户:
1 | #这里按照官网创建git user |
二、Nginx 反向代理(宝塔)
如果使用 HTTPS,必须在 Nginx 配置中添加 X-Forwarded-Proto 头,否则 Gitea 会报错:
1 | The detected web site URL is "[http://xxxxxx.xxx/](http://git.yc2019.cn/)", it's unlikely matching the site config. Mismatched app.ini ROOT_URL or reverse proxy "Host/X-Forwarded-Proto" config might cause wrong URL links for web UI/mail content/webhook notification/OAuth2 sign-in. |
需要在配置中加入:
1 | proxy_set_header X-Forwarded-Proto $scheme; |
下面是我的完整 Nginx 配置,供参考:
1 | proxy_pass http://127.0.0.1:3000; |
三、安装与配置 Act Runner
下载地址:https://dl.gitea.com/act_runner/
- 注册 Runner
1
2
3
4
5
6
7
8
9
10
11
12
13./act_runner register
#Instance URL: https://xxxxx.xx 你的域名
#Runner token: 后台获取
#Runner name: 可以留空(默认主机名)
#Runner labels: 这里必须手动输入,输入以下内容:self-hosted,ubuntu-latest
#创建配置文件并启动
cat > config.yaml << 'EOF'
runner:
mode: "host"
EOF
./act_runner daemon --config config.yaml为什么要使用宿主机模式(mode: “host”)?因为 Gitea 不支持类似 GitHub/GitLab Pages 的功能,我需要将构建生成的静态文件直接复制到宿主机的网站目录(如 /www/wwwroot/hexo)中,而 Docker 模式下不便操作宿主机文件系统。
四、工作流示例:部署 public 文件夹到宿主机
下面是一个 .gitea/workflows/deploy.yml 示例,当 push 到 main 分支时,自动将仓库中的 public/ 目录复制到宿主机的 /www/wwwroot/hexo/ 下。
1 | name: Deploy public folder to host |
- 标题: 使用 Gitea + Act Runner 搭建本地工作流(无 Docker), Nginx 反向代理报错问题
- 作者: Ydecl/忧
- 创建于 : 2026-06-09 22:05:00
- 更新于 : 2026-06-09 22:12:16
- 链接: https://blog.yc2019.cn/posts/gitea-server.html
- 版权声明: 本文章采用 CC BY-NC-SA 4.0 进行许可。