英文:
Connect local domain to Django
问题
我有几个应用程序正在Docker上运行。它们每个都有自己的域名,但是当我启动容器时,我只能在127.0.0.1:8000
或127.0.0.1:8001
上访问它们。但我需要通过类似test1.mydomain.local
和test2.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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论