个人财务管理利器:Wallos 的完整部署与 HTTPS 配置指南

创建于2026.03.04预计阅读5 分钟
个人财务管理利器:Wallos 的完整部署与 HTTPS 配置指南

Wallos 是一款开源、轻量的个人订阅追踪与财务管理工具。本文记录如何利用 Docker 快速部署 Wallos,并通过 Nginx 配置 HTTPS 安全访问。

HTTPS 部分根据 Cloudflare 的代理状态分为两种方式:

  • Cloudflare Proxied(橙色云):推荐使用 Cloudflare Origin Certificate。
  • DNS Only(灰色云):推荐使用 Let’s Encrypt + acme.sh。

一、环境准备

  • 服务器:Linux VPS(Ubuntu / Debian)
  • 域名:wallos.yl.do
  • 工具:Docker、Docker Compose、Nginx
  • 可选工具:acme.sh(仅 Let’s Encrypt 方案需要)

二、部署 Wallos 服务

首先使用 Docker Compose 部署 Wallos。为了确保账单提醒时间准确,将时区设置为 Asia/Shanghai。

创建部署目录

Shell
mkdir -p ~/wallos && cd ~/wallos
mkdir db logos

编写 docker-compose.yml

YAML
services:
  wallos:
    container_name: wallos
    image: bellamy/wallos:latest
    ports:
      - "8282:80/tcp"
    environment:
      TZ: "Asia/Shanghai"
    volumes:
      - "./db:/var/www/html/db"
      - "./logos:/var/www/html/images/uploads/logos"
    restart: unless-stopped

启动服务

Shell
docker compose up -d

检查:

Shell
docker ps

也可以通过:

Shell
curl http://127.0.0.1:8282

确认 Wallos 已正常运行。


三、Nginx 反向代理与 HTTPS 配置

这里需要根据 Cloudflare 中域名的 Proxy Status 选择一种方案。

方案一:Cloudflare Proxied

如果 Cloudflare DNS 中:

wallos.yl.do → Proxied 🟠

推荐使用 Cloudflare Origin Certificate。

整体连接关系:

浏览器
   ↓ HTTPS
Cloudflare
   ↓ HTTPS
Nginx
   ↓ HTTP
Wallos :8282

浏览器看到的是 Cloudflare 提供的公开可信证书,而服务器上的 Origin Certificate 只负责:

Cloudflare ↔ Nginx

之间的 HTTPS。

创建 Cloudflare Origin Certificate

进入 Cloudflare:

SSL/TLS
→ Origin Server
→ Create Certificate

Hostnames 填写:

wallos.yl.do

或者使用通配符:

*.yl.do
yl.do

Cloudflare 会提供证书和私钥。

  • Origin Certificate
  • Private Key

把它们保存到服务器。

例如:

Shell
mkdir -p /etc/nginx/ssl/wallos.yl.do

证书:

/etc/nginx/ssl/wallos.yl.do/origin.pem

私钥:

/etc/nginx/ssl/wallos.yl.do/origin.key

设置私钥权限:

Shell
chmod 600 /etc/nginx/ssl/wallos.yl.do/origin.key

可以检查证书:

Shell
openssl x509 \
  -in /etc/nginx/ssl/wallos.yl.do/origin.pem \
  -noout -subject -issuer -dates -ext subjectAltName

配置 Nginx

编辑:

Shell
nano /etc/nginx/conf.d/wallos.conf

写入:

nginx
server {
    listen 80;
    listen [::]:80;
    server_name wallos.yl.do;

    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl;
    listen [::]:443 ssl;
    server_name wallos.yl.do;

    ssl_certificate     /etc/nginx/ssl/wallos.yl.do/origin.pem;
    ssl_certificate_key /etc/nginx/ssl/wallos.yl.do/origin.key;

    client_max_body_size 20M;

    location / {
        proxy_pass http://127.0.0.1:8282;

        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

检查并重新加载:

Shell
nginx -t && systemctl reload nginx

配置 Cloudflare SSL 模式

进入:

SSL/TLS
→ Overview

设置为:

Full (strict)

不建议使用:

Flexible

因为 Flexible 模式下 Cloudflare 到源服务器使用 HTTP,而 Nginx 又会把 HTTP 重定向到 HTTPS,容易产生重定向循环。

使用:

Full (strict)

后,Cloudflare 会通过 HTTPS 连接源服务器,并验证 Origin Certificate,详见 Full (strict) 模式说明。

这种方案下:

不需要 acme.sh
不需要 Let's Encrypt
不需要每隔几个月续签

Cloudflare Origin Certificate 可以设置很长的有效期。


方案二:Cloudflare DNS Only

如果 Cloudflare DNS 中:

wallos.yl.do → DNS Only ☁️

浏览器会直接连接服务器:

浏览器
   ↓ HTTPS
Nginx
   ↓
Wallos :8282

此时应该使用浏览器公开信任的证书,例如 Let’s Encrypt。

可以使用 acme.sh 自动申请和续签。

配置 HTTP 验证

编辑:

Shell
nano /etc/nginx/conf.d/wallos.conf

先配置:

nginx
server {
    listen 80;
    listen [::]:80;
    server_name wallos.yl.do;

    location /.well-known/acme-challenge/ {
        root /var/www/html;
        try_files $uri =404;
    }

    location / {
        return 301 https://$host$request_uri;
    }
}

创建验证目录:

Shell
mkdir -p /var/www/html/.well-known/acme-challenge

检查:

Shell
nginx -t && systemctl reload nginx

使用 acme.sh 申请证书

申请 ECC 证书:

Shell
acme.sh --issue \
  -d wallos.yl.do \
  --webroot /var/www/html \
  --ecc

创建证书目录:

Shell
mkdir -p /etc/nginx/ssl/wallos.yl.do/

安装证书:

Shell
acme.sh --install-cert \
  -d wallos.yl.do \
  --ecc \
  --key-file /etc/nginx/ssl/wallos.yl.do/key.pem \
  --fullchain-file /etc/nginx/ssl/wallos.yl.do/cert.pem \
  --reloadcmd "systemctl reload nginx"

完善 HTTPS 配置

最终 /etc/nginx/conf.d/wallos.conf:

nginx
server {
    listen 80;
    listen [::]:80;
    server_name wallos.yl.do;

    location /.well-known/acme-challenge/ {
        root /var/www/html;
        try_files $uri =404;
    }

    location / {
        return 301 https://$host$request_uri;
    }
}

server {
    listen 443 ssl;
    listen [::]:443 ssl;
    server_name wallos.yl.do;

    ssl_certificate     /etc/nginx/ssl/wallos.yl.do/cert.pem;
    ssl_certificate_key /etc/nginx/ssl/wallos.yl.do/key.pem;

    client_max_body_size 20M;

    location / {
        proxy_pass http://127.0.0.1:8282;

        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

检查并重新加载:

Shell
nginx -t && systemctl reload nginx

四、Cloudflare 代理状态对证书的影响

Proxied

如果使用:

Proxied 🟠

浏览器实际上连接的是 Cloudflare。

浏览器因此看到的是:

Cloudflare Edge Certificate

而 Nginx 使用:

Cloudflare Origin Certificate

负责 Cloudflare 到源服务器之间的加密。

推荐:

SSL/TLS Mode = Full (strict)

DNS Only

如果使用:

DNS Only ☁️

浏览器会直接访问服务器。

浏览器因此看到的是 Nginx 实际配置的证书。

这种情况下应该使用:

Let's Encrypt

等公开可信证书。

Cloudflare Origin Certificate 不适合浏览器直接访问,因为普通浏览器并不直接信任 Cloudflare Origin CA。


五、自动化维护

Let’s Encrypt 证书续期

这一部分只适用于:

DNS Only + Let's Encrypt

acme.sh 安装后通常会自动创建 cron。

查看:

Shell
crontab -l

例如:

57 23 * * * "/root/.acme.sh"/acme.sh --cron --home "/root/.acme.sh" > /dev/null

acme.sh 会定期检查证书是否需要续签。

因为使用 Webroot:

/var/www/html/.well-known/acme-challenge/

所以续签时不需要停止 Nginx,也不会产生 80 端口冲突。

续签成功之后:

Shell
systemctl reload nginx

会通过 --reloadcmd 自动执行。

如果使用的是:

Cloudflare Proxied + Origin Certificate

则不需要这一套自动续签机制。

Wallos 镜像更新

当 Wallos 发布新版本时:

Shell
cd ~/wallos

docker compose pull
docker compose up -d

清理旧镜像:

Shell
docker image prune -f

由于数据通过:

./db
./logos

挂载到了宿主机,因此更新容器不会丢失数据。

常用日志查询

Nginx 访问日志:

Shell
tail -f /var/log/nginx/access.log

Nginx 错误日志:

Shell
tail -f /var/log/nginx/error.log

Wallos 日志:

Shell
docker logs -f wallos

检查 Nginx 配置:

Shell
nginx -t

检查监听端口:

Shell
ss -lntp | grep -E ':80 |:443 '

六、总结

通过:

Docker
+
Nginx
+
Cloudflare

即可搭建一个完整的 Wallos HTTPS 服务。

如果域名长期使用 Cloudflare 代理:

Cloudflare Proxied
+
Cloudflare Origin Certificate
+
Full (strict)

是更简单的方案,不需要额外维护 Let’s Encrypt 证书。

如果域名使用:

DNS Only

或者需要浏览器直接连接源服务器,则使用:

Let's Encrypt
+
acme.sh
+
Webroot

更加合适。

两种方案最终的 Wallos 和 Nginx 反向代理逻辑都一样,区别主要在于 浏览器是否经过 Cloudflare,以及 Nginx 应该使用哪一种 SSL 证书。

Yi Liu

© 2026 Yi Liu

GitHubRSS