无法通过 HTTPS 连接到 Docker 中运行的 WikiJS

无法通过 HTTPS 连接到 Docker 中运行的 WikiJS

我在 DigitalOcean droplet 上安装了新的 WikiJS(使用市场镜像)。我无法通过 HTTPS 访问该网站,无论是使用域名还是 IP 地址,但 HTTP 可以访问。

Unable to connect在 Firefox 中收到一个很普通的错误。底层错误消息似乎是NS_ERROR_CONNECTION_REFUSED,但我实际上看不到任何响应。

据我所知,没有防火墙规则阻止任何内容,Docker 反向代理正在运行并监听端口 80:

ps aux

root       24755  0.0  0.2 1148340 2864 ?        Sl   15:26   0:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 80 -container-ip
root       24760  0.0  0.2 1148340 2920 ?        Sl   15:26   0:00 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 80 -container-ip 172.

下面是 的输出docker logs wiki。我注意到有两行关于 HTTP 服务器运行的内容,但没有关于 HTTPS 的内容,但是我不知道如何启用或禁用它(我没有做任何特别的事情,实际上只是从映像中安装)。

2023-12-09T15:27:00.083Z [MASTER] info: =======================================
2023-12-09T15:27:00.087Z [MASTER] info: = Wiki.js 2.5.300 =====================
2023-12-09T15:27:00.087Z [MASTER] info: =======================================
2023-12-09T15:27:00.088Z [MASTER] info: Initializing...
2023-12-09T15:27:01.800Z [MASTER] info: Using database driver pg for postgres [ OK ]
2023-12-09T15:27:01.808Z [MASTER] info: Connecting to database...
2023-12-09T15:27:01.852Z [MASTER] info: Database Connection Successful [ OK ]
2023-12-09T15:27:03.533Z [MASTER] warn: Mail is not setup! Please set the configuration in the administration area!
2023-12-09T15:27:03.759Z [MASTER] info: Loading GraphQL Schema...
2023-12-09T15:27:06.173Z [MASTER] info: GraphQL Schema: [ OK ]
2023-12-09T15:27:06.738Z [MASTER] info: HTTP Server on port: [ 3000 ]
2023-12-09T15:27:06.784Z [MASTER] info: HTTP Server: [ RUNNING ]
2023-12-09T15:27:07.234Z [MASTER] info: Telemetry is active: [ OK ]
2023-12-09T15:27:07.340Z [MASTER] info: No new analytics providers found: [ SKIPPED ]
2023-12-09T15:27:07.431Z [MASTER] info: Loaded 21 authentication strategies: [ OK ]
2023-12-09T15:27:07.476Z [MASTER] info: No new comment providers found: [ SKIPPED ]
2023-12-09T15:27:07.509Z [MASTER] info: No new editors found: [ SKIPPED ]
2023-12-09T15:27:07.604Z [MASTER] info: No new loggers found: [ SKIPPED ]
2023-12-09T15:27:07.705Z [MASTER] info: No new renderers found: [ SKIPPED ]
2023-12-09T15:27:07.756Z [MASTER] info: No new search engines found: [ SKIPPED ]
2023-12-09T15:27:07.833Z [MASTER] info: No new storage targets found: [ SKIPPED ]
2023-12-09T15:27:07.835Z [MASTER] info: Checking for installed optional extensions...
2023-12-09T15:27:07.858Z [MASTER] info: Optional extension git is installed. [ OK ]
2023-12-09T15:27:07.874Z [MASTER] info: Optional extension pandoc was not found on this system. [ SKIPPED ]
2023-12-09T15:27:07.889Z [MASTER] info: Optional extension puppeteer was not found on this system. [ SKIPPED ]
2023-12-09T15:27:07.892Z [MASTER] info: Optional extension sharp was not found on this system. [ SKIPPED ]
2023-12-09T15:27:07.902Z [MASTER] info: Authentication Strategy Local: [ OK ]
2023-12-09T15:27:09.639Z [MASTER] info: (COMMENTS/DEFAULT) Initializing...
2023-12-09T15:27:09.640Z [MASTER] info: (COMMENTS/DEFAULT) Initialization completed.
2023-12-09T15:27:09.651Z [MASTER] info: (SEARCH/POSTGRES) Initializing...
2023-12-09T15:27:09.660Z [MASTER] info: (SEARCH/POSTGRES) Initialization completed.
2023-12-09T15:27:09.709Z [MASTER] info: (STORAGE/GIT) Initializing...
2023-12-09T15:27:09.711Z [MASTER] info: (STORAGE/GIT) Checking repository state...
2023-12-09T15:27:10.013Z [MASTER] info: (STORAGE/GIT) Listing existing remotes...
2023-12-09T15:27:10.030Z [MASTER] info: (STORAGE/GIT) Purging existing remotes...
2023-12-09T15:27:10.099Z [MASTER] info: (STORAGE/GIT) Setting SSL Verification config...
2023-12-09T15:27:10.168Z [MASTER] info: (STORAGE/GIT) Setting SSH Command config...
2023-12-09T15:27:10.239Z [MASTER] info: (STORAGE/GIT) Adding origin remote via SSH...
2023-12-09T15:27:10.305Z [MASTER] info: (STORAGE/GIT) Fetch updates from remote...
2023-12-09T15:27:11.652Z [MASTER] info: (STORAGE/GIT) Checking out branch main...
2023-12-09T15:27:11.696Z [MASTER] info: (STORAGE/GIT) Performing pull rebase from origin on branch main...
2023-12-09T15:27:12.967Z [MASTER] info: (STORAGE/GIT) Performing push to origin on branch main...
2023-12-09T15:27:13.936Z [MASTER] info: Purging orphaned upload files...
2023-12-09T15:27:13.939Z [MASTER] info: Syncing locales with Graph endpoint...
2023-12-09T15:27:13.942Z [MASTER] info: Fetching latest updates from Graph endpoint...
2023-12-09T15:27:13.985Z [MASTER] info: Purging orphaned upload files: [ COMPLETED ]
2023-12-09T15:27:14.145Z [MASTER] info: Fetching latest updates from Graph endpoint: [ COMPLETED ]
Loading configuration from /wiki/config.yml... OK
DB_PASS_FILE is defined. Will use secret from file.
2023-12-09T15:27:14.477Z [JOB] info: Rebuilding page tree...
2023-12-09T15:27:14.758Z [MASTER] info: Pulled latest locale updates for English from Graph endpoint: [ COMPLETED ]
2023-12-09T15:27:14.769Z [MASTER] info: Syncing locales with Graph endpoint: [ COMPLETED ]
2023-12-09T15:27:16.042Z [JOB] info: Using database driver pg for postgres [ OK ]
2023-12-09T15:27:16.251Z [JOB] info: Rebuilding page tree: [ COMPLETED ]

我有点不知所措,甚至不知道该如何尝试找出问题所在...任何关于值得关注的事情的建议都将不胜感激。

答案1

我设法解决了这个问题。我仍然不知道是什么原因造成的,但我发现 config.yml 文件引用了 SSL_ACTIVE 和一堆与 SSL 设置有关的其他环境变量(请参阅以下文档:https://docs.requarks.io/install/config#lets-encrypt)。

但是,这些变量实际上都不存在(我通过运行 docker exec -it wiki bash 然后 printenv 来查看 docker 容器中的环境变量)。我的假设是,由于 SSL_ACTIVE 未定义,WikiJS 不会启动 443 监听服务。

因此我将 config.yml 文件(使用 docker cp)更改为正确的值,然后重新启动后 HTTPS 侦听器启动,一切正常工作。

答案2

我遇到了类似的问题。我有点困惑你是如何解决这个问题的。你有时间详细说明一下你做了 docker cp 是什么意思吗?我以为只要你更改配置文件的主机副本,它就会自动更新容器中的副本。感谢你的帮助。谢谢!

相关内容