连接本地域名到Django

huangapple go评论59阅读模式
英文:

Connect local domain to Django

问题

我有几个应用程序正在Docker上运行。它们每个都有自己的域名,但是当我启动容器时,我只能在127.0.0.1:8000127.0.0.1:8001上访问它们。但我需要通过类似test1.mydomain.localtest2.mydomain.local这样的域名来访问它们。

我尝试更改我的主机文件如下:

127.0.0.1 *.mydomain.local

127.0.0.1 localhost

然而,当我再次启动Docker时,它不起作用。我有一个.env文件,其中包含所有域名,但我不知道如何让它起作用。

请帮助我找出解决方法。

英文:

I have several applications that I'm running on Docker. Each one of them has own domain, however when I start containers I can access them only on 127.0.0.1:8000 or 127.0.0.1:8001. But I need to reach them on domain like test1.mydomain.local and test2.mydomain.local.

I tried to change my host file like this:

> 127.0.0.1 *.mydomain.local
>
> 127.0.0.1 localhost

However when I start docker again - it doesn't work. I have .env file where all domains are written down but I don't get how to get this worked.

Please help me to figure it out.

答案1

得分: 1

不可能在主机文件中指定通配符。请明确设置它们或使用本地DNS。

英文:

It's not possible to specify wildcards in the host file. Set them explicitly or use a local DNS.

huangapple
  • 本文由 发表于 2023年2月16日 05:35:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/75465663.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定