我正在尝试通过 Dokku 在 Docker 中运行 Forem 论坛软件。我遵循了以下指南:https://dev.to/akhilnaidu/self-hosting-forem-dev-on-linux-using-t2d-2kgh
域名 evstalkin.com 的 A 记录指向 VPS 的 IP 地址。
现在我的 VPS(Ubuntu 22.04、Afterburst.com)上运行着两个 Docker 容器,浏览器中显示了一条错误消息。(“很抱歉,但出了点问题。”并且它的 CSS 比通常的 nginx 错误消息更花哨,所以我认为它来自 t2d 脚本所做的配置。)
/var/log/nginx/nforem-error.log显示:
2024/02/01 14:09:20 [error] 177919#177919: *1449 connect() failed (111: Unknown error) while connecting to upstream, client: 94.113.160.209, server: evstalkin.com, request: "GET / HTTP/1.1", upstream: "http://172.17.0.5:5000/", host: "evstalkin.com"
并且'docker ps'说:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5df9cfa0ef53 dokku/nforem:latest "/start sidekiq_work…" 2 days ago Up 2 days nforem.sidekiq_worker.1
6217bf35a442 dokku/oforem:latest "/start sidekiq_work…" 2 days ago Up 2 days oforem.sidekiq_worker.1
ffab6be18567 redis:7.2.4 "docker-entrypoint.s…" 2 days ago Up 2 days 6379/tcp dokku.redis.redisdb
54678f0806cd postgres:16.1 "docker-entrypoint.s…" 2 days ago Up 2 days 5432/tcp dokku.postgres.foremdb
所以我认为 nginx 无法与 Forem 容器通信,因为它们没有暴露任何端口。
我查看了其他一些东西,但没有发现任何看起来像配置错误的东西。
# grep -R 172.17.0.5 /home/dokku/*
/home/dokku/nforem/IP.sidekiq_worker.1:172.17.0.5
/home/dokku/nforem/IP.web.1:172.17.0.5
/home/dokku/nforem/nginx.conf: server 172.17.0.5:5000;
# cat /home/dokku/nforem/nginx.conf
server {
listen [::]:80;
listen 80;
server_name evstalkin.com;
access_log /var/log/nginx/nforem-access.log;
error_log /var/log/nginx/nforem-error.log;
location / {
gzip on;
gzip_min_length 1100;
gzip_buffers 4 32k;
gzip_types text/css text/javascript text/xml text/plain text/x-component application/javascript application/x-javascript application/wasm application/json application/xml application/rss+xml font/truetype application/x-font-ttf font/opentype application/vnd.ms-fontobject image/svg+xml;
gzip_vary on;
gzip_comp_level 6;
proxy_pass http://nforem-5000;
proxy_http_version 1.1;
proxy_read_timeout 60s;
proxy_buffer_size 4096;
proxy_buffering on;
proxy_buffers 8 4096;
proxy_busy_buffers_size 8192;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Request-Start $msec;
}
error_page 400 401 402 403 405 406 407 408 409 410 411 412 413 414 415 416 417 418 420 422 423 424 426 428 429 431 444 449 450 451 /400-error.html;
location /400-error.html {
root /var/lib/dokku/data/nginx-vhosts/dokku-errors;
internal;
}
error_page 404 /404-error.html;
location /404-error.html {
root /var/lib/dokku/data/nginx-vhosts/dokku-errors;
internal;
}
error_page 500 501 502 503 504 505 506 507 508 509 510 511 /500-error.html;
location /500-error.html {
root /var/lib/dokku/data/nginx-vhosts/dokku-errors;
internal;
}
include /home/dokku/nforem/nginx.conf.d/*.conf;
}
upstream nforem-5000 {
server 172.17.0.5:5000;
}
# netstat -tulpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 686/nginx: master p
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 655/sshd: /usr/sbin
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 581/systemd-resolve
tcp6 0 0 :::80 :::* LISTEN 686/nginx: master p
tcp6 0 0 :::22 :::* LISTEN 655/sshd: /usr/sbin
udp 0 0 127.0.0.53:53 0.0.0.0:* 581/systemd-resolve
udp 0 0 209.222.17.233:68 0.0.0.0:* 579/systemd-network
我如何知道需要配置什么?非常感谢。bhy
答案1
Forem 似乎有一个 docker compose,可以发布端口,我会先运行它