本文介绍了Dokku - 设置后添加域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的 Digital Ocean Droplet 上安装了 Dokku,但在设置我的 dns 记录之前安装了 Dokku,所以 Dokku 安装在 IP 上.现在我更改了我的 dns 记录,因此可以通过 site.com 访问该站点.我可以通过 site.com:port 访问我之前创建的 Dokku 容器,如何更改 Dokku 设置以访问我的应用程序 - appname.site.com

I installed Dokku on my Digital Ocean droplet, but did it before setting my dns records, so Dokku was installed on IP. Now I changed my dns record, so site can be accessed through site.com. I can access my previously created Dokku containers through site.com:port, how can I change Dokku settings to access my app like this - appname.site.com

推荐答案

Per https://github.com/progrium/dokku:

设置一个域和一个指向该主机的通配符域.确保/home/dokku/VHOST 设置为此域.默认情况下它设置为主机拥有的任何主机名.该文件仅在以下情况下创建主机名可以通过 dig (dig +short $(hostname -f)) 解析.否则您必须手动创建文件并将其设置为您的首选领域.如果推送应用程序时此文件仍然不存在,dokku 将发布带有端口号的应用程序(即http://example.com:49154 - 请注意缺少的子域).

要解决此问题,您首先需要更新/home/dokku/VHOST 文件,添加域名——这将修复任何新生成的部署,但需要从/home/中删除现有应用程序dokku 目录按名称(/home/dokku/foo、/home/dokku/bar 等)并重新部署以使此更改生效,因为每个 Dokku 应用程序在这些/home/dokku/路径中都有一个单独的 nginx.conf 和那些需要重写.

To fix the issue, you will first need to update the /home/dokku/VHOST file, adding the domain name -- this will fix any newly generated deployments, but existing apps will need to be deleted from the /home/dokku directory by name (/home/dokku/foo, /home/dokku/bar, etc.) and redeployed for this change to take effect, since each Dokku application has a separate nginx.conf within those /home/dokku/ paths and those will need to be re-written.

这篇关于Dokku - 设置后添加域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-15 13:35