Ruby 安装 homeland 无法打开网站,可以帮忙看看吗?

Lucky_Tips · 2021年06月04日 · 最后由 Lucky_Tips 回复于 2021年06月06日 · 434 次阅读

参照https://ruby-china.org/topics/41129,修改 homeland-docker 的文件 etc/caddy/Caddyfile 如下

@huacnlee 大佬帮忙看看

版本号如下:

$ sudo lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.5 LTS
Release:    18.04
Codename:   bionic

aabbcc 是代替域名

方式一:

{$domain},www.{$domain}

reverse_proxy {
  to web:80
}

app.local.env 配置文件如下:

app_name=aabbcc
domain=aabbcc.com
admin_emails=admin@admin.com

方式二:

{$domain}

reverse_proxy {
  to web:80
}

app.local.env 配置文件如下:

app_name=aabbcc
domain=*.aabbcc.com
admin_emails=admin@admin.com

然后关掉服务后重启,查看状态正常,索引正常

$ sudo make stop-all
Stopping homeland_caddy      ... done
Stopping homeland_web        ... done
Stopping homeland_worker     ... done
Stopping homeland_app        ... done
Stopping homeland_app_backup ... done
Stopping homeland_postgresql ... done
Stopping homeland_redis      ... done
Removing homelanddocker_app_run_2 ... done
Removing homelanddocker_app_run_1 ... done
Removing homeland_caddy           ... done
Removing homeland_web             ... done
Removing homeland_worker          ... done
Removing homeland_app             ... done
Removing homeland_app_backup      ... done
Removing homeland_postgresql      ... done
Removing homeland_redis           ... done
Removing network homelanddocker_default

$ sudo make start
Creating network "homelanddocker_default" with the default driver
Creating homeland_redis ... 
Creating homeland_postgresql ... 
Creating homeland_postgresql
Creating homeland_redis ... done
Creating homeland_app ... 
Creating homeland_app_backup ... 
Creating homeland_worker ... 
Creating homeland_app
Creating homeland_app_backup
Creating homeland_worker ... done
Creating homeland_web ... 
Creating homeland_web ... done
Creating homeland_caddy ... 
Creating homeland_caddy ... done


$ sudo make status
       Name                      Command               State                                        Ports                                       
-----------------------------------------------------------------------------------------------------------------------------------------------
homeland_app          /home/app/homeland/bin/doc ...   Up      0.0.0.0:49179->7000/tcp,:::49179->7000/tcp                                       
homeland_app_backup   bundle exec puma -C config ...   Up      0.0.0.0:49178->7001/tcp,:::49178->7001/tcp                                       
homeland_caddy        caddy run --config /etc/ca ...   Up      2019/tcp, 0.0.0.0:443->443/tcp,:::443->443/tcp, 0.0.0.0:80->80/tcp,:::80->80/tcp 
homeland_postgresql   docker-entrypoint.sh postgres    Up      0.0.0.0:49176->5432/tcp,:::49176->5432/tcp                                       
homeland_redis        docker-entrypoint.sh redis ...   Up      0.0.0.0:49177->6379/tcp,:::49177->6379/tcp                                       
homeland_web          /etc/nginx/start                 Up      0.0.0.0:8080->80/tcp,:::8080->80/tcp                                             
homeland_worker       bundle exec sidekiq -C con ...   Up          

$ sudo make reindex
Reindex Search...
Starting homeland_postgresql ... 
Starting homeland_redis ... done
Reindexing topicsdone
Reindexing usersdone

域名解析正常

ssl 证书成功申请

两种方式都无法打开网站

nginx 日志,puma 日志贴上来看看

@Dounx 问一下 nginx 日志,puma 日志命令是啥


$ docker-compose logs app
Attaching to homeland_app
homeland_app  | [9] Puma starting in cluster mode...
homeland_app  | [9] * Puma version: 5.1.0 (ruby 2.7.2-p137) ("At Your Service")
homeland_app  | [9] *  Min threads: 8
homeland_app  | [9] *  Max threads: 8
homeland_app  | [9] *  Environment: production
homeland_app  | [9] *   Master PID: 9
homeland_app  | [9] *      Workers: 4
homeland_app  | [9] *     Restarts: (✔) hot (✖) phased
homeland_app  | [9] * Preloading application
homeland_app  | [9] * Listening on http://0.0.0.0:7000
homeland_app  | [9] Use Ctrl-C to stop
homeland_app  | [9] ! Promoting existing objects to old generation...
homeland_app  | [9] ! Compacting...
homeland_app  | [9] ! Friendly fork preparation complete.
homeland_app  | [9] - Worker 0 (PID: 12) booted, phase: 0
homeland_app  | [9] - Worker 1 (PID: 16) booted, phase: 0
homeland_app  | [9] - Worker 2 (PID: 24) booted, phase: 0
homeland_app  | [9] - Worker 3 (PID: 34) booted, phase: 0

执行一下:docker-compose logs web

Dounx 回复
$ docker-compose logs web
Attaching to homeland_web

你进 web 的 docker container 里看看 /var/log/nginx 下面的日志

顺便一问,你用 8080 能访问吗?

8 楼 已删除

好像也不可以 @Dounx

10 楼 已删除

最后在网友的帮助下,找到问题所在,防火墙没有开放必要的端口。导致无法访问。目前开启了 80,443,还有一个 ssh 远程访问端口。

需要 登录 后方可回复, 如果你还没有账号请 注册新账号