0

I've tried to deploy two nodeJS apps on Digitalocean using a dokku droplet. I am using the "virtualhost naming" scheme but there is a problem.

My DNS configuration looks like this:

enter image description here

I have the main app and the admin app. I would expect to view the admin app when i visit app.example.com (I actually have a proper domain name) but I can see the same app when hitting example.com and app.example.com.

There is something wrong with nginx probably, but I don't know exactly what is going bad?

4

1 回答 1

0

我注意到的一件事是,首先安装的应用程序将是 example.com 转发到的应用程序。

您将此行为归因于 Nginx 是正确的。我认为这是因为当它没有检测到 example.com 的配置时,它会以某种方式回到这个配置

这个 dokku 插件 ( https://github.com/progrium/dokku/tree/master/plugins/nginx-vhosts ) 负责在每次部署每个应用程序时重写 nginx.conf。

现在它使用模板 nginx.conf ( https://github.com/progrium/dokku/blob/master/plugins/nginx-vhosts/templates/nginx.conf ) 虽然这是一个相当新的变化所以请确保你在最新版本。

您最终将获得如下所示的 Nginx 配置:

server {
  listen      [::]:80;
  listen      80;
  server_name app.example.com;
  return 301 https://$host$request_uri;
}

我目前不确定为什么上述代码段会导致所描述的行为。一种解决方法是在 /etc/nginx/sites-enabled/ 中设置您自己的 nginx conf

server_name example.com;

但指向一个控股页面或任何适合你的东西。

于 2015-01-12T13:38:32.263 回答