简体   繁体   English

如何在Dokku中更改域主机名的默认应用程序

[英]How to change Default App in Dokku for Domain Host Name

As a personal project I've deployed the Dokku Image on Digital Ocean and got everything working well. 作为一个个人项目,我在数字海洋上部署了Dokku图像并使一切运行良好。 In fact it works very well as I've done it before, but I have a question on how I can change what "default" app the Domain Host Name points to. 事实上,它之前我已经完成了很好的工作,但我对如何更改域主机名所指的“默认”应用程序有疑问。

Here is my setup. 这是我的设置。

  1. I set up Dokku on Digital Ocean with the "Hostname" and "Virtualhost Naming" options selected. 我在Digital Ocean上设置了Dokku,并选择了“Hostname”和“Virtualhost Naming”选项。 So basically this means that I have my own Domain Name being used to point to apps instead of the IP/Port. 所以基本上这意味着我有自己的域名用于指向应用而不是IP /端口。 Lets assume my Domain Name is mydomain.com 假设我的域名是mydomain.com

  2. I have 2 Dokku apps running in this Digital Ocean server. 我在这台Digital Ocean服务器上运行了2个Dokku应用程序。 Lets call them app-a and app-b . 让我们称他们为app-aapp-b As I enabled "virtual naming" these apps can be accessed like so. 当我启用“虚拟命名”时,可以像这样访问这些应用程序。

    • app-a .mydomain.com app-a .mydomain.com
    • app-b .mydomain.com app-b .mydomain.com

All this works perfectly. 这一切都很完美。

  1. List item 项目清单

Now I notice that if I go to "mydomain.com" or "www.mydomain.com" in the browser it "defaults/redirects with masking" to " app-b .mydomain.com". 现在我注意到,如果我在浏览器中转到“mydomain.com”或“www.mydomain.com”,它会“默认/重定向并屏蔽”到“ app-b .mydomain.com”。 My guess is that because app-b was the last App I set up NGINX has defaulted to this. 我的猜测是,因为app-b是我设置的最后一个应用程序NGINX违约了。

So how can I change this behaviour, ie I need "mydomain.com" or "www.mydomain.com" to go to app-a instead? 那么我该如何改变这种行为,即我需要“mydomain.com”或“www.mydomain.com”转到app-a?

Thanks very much in advance. 首先十分感谢。

Mark. 标记。

By default, dokku will route any received request with an unknown HOST header value to the lexicographically first site in the nginx config stack. 默认情况下,dokku会将任何收到的带有未知HOST头值的请求路由到nginx配置堆栈中的字典第一个站点。

I believe you can add root domain using domains plugin 我相信你可以使用domains插件添加根域

# add a domain to an app
dokku domains:add app-a mydomain.com

or 要么

You can also specify fully qualified names as the name of the app 您还可以指定完全限定名称作为应用程序的名称

$ git remote add dokku dokku@dokku.me:mydomain.com
$ git push dokku master

or 要么

Alternatively, you may push an app to your dokku host with a name like "00-default". 或者,您可以将应用程序推送到dokku主机,名称为“00-default”。 As long as it lists first, it will be used as the default nginx vhost. 只要它首先列出,它将被用作默认的nginx vhost。


References: 参考文献:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM