Reputation: 2606
I'm new to docker and my question is similar to:
My websites running in docker containers, how to implement virtual host?
But I don't actually need to host multiple sites with different virtual hosts. I just need to get the server to respond to a particular virtual host name, eg: myhost.mysite.com
Right now the site works fine via IP but won't respond when I use the host name. Since I only have the one site/hostname do I have to setup a proxy as described in the question?
I've tried adding a -h 'myhost.mysite.com' to my docker run command but that didn't seem to make any difference.
PS. hostname DNS does correctly resolve to the IP address of the docker server.
Upvotes: 2
Views: 1015
Reputation: 56588
That really depends on the web server running inside the container.
ServerName
and possibly ServerAlias
server_name
ALLOWED_HOSTS
Really, Docker doesn't need to know. The HTTP server software needs to know.
The question you linked to deals with multiple sites, which is why a proxy was needed. If you are only running one site, a proxy is not necessary (at least, not for this purpose). Just let Docker listen on port 80 and/or 443 itself, and let the server software running inside decide what hostname(s) are valid for the site.
Upvotes: 2