How to make virtual hosts accesible from the Internet?

Hello:

I’m setting up devilbox on a VPS, so that my team can have a development server for our LAMP apps.
Now, I understand that creating virtual hosts accesible from your own local machine is easy: you just create subdirectories in your HOST_PATH_HTTPD_DATADIR, and they will be automatically available at your-subdirectory-name.TLD_SUFFIX (as long as you add that name in your local machine’s hosts file). But how do I make the virtual hosts available across the Internet?

I understand that first I’d have to add a DNS entry at, for example, “my website.mydomain.com” pointing at the VPS. But how do I configure the virtual host inside devilbox so that it responds to that DNS name? And what happens with devilbox’s own BIND server? Will it start answering queries for “my domain.com”, when it’s not listed as an authoritative DNS server for my domain? Will that cause any problems?

See here: https://github.com/cytopia/devilbox/issues/262#issuecomment-471169136

Thanks for responding. In the end, it was much easier than I thought; I read the instructions here:

https://devilbox.readthedocs.io/en/latest/corporate-usage/shared-devilbox-server-in-lan.html#use-a-real-domain

So I added a wildcard entry in my DNS server, and then I just configured the devilbox’s TLD_SUFFIX to respond to it. Then it was just a matter of adding virtualhosts, and they were all recognised automatically.

That what’s I thought at first, but didn’t answer because you can specify only one TLD_SUFFIX, which is somewhat limiting.

Yes you can, but then you can add an unlimited number of virtual hosts (I didn’t know you could add wildcard DNS suffixes, which is the trick that makes all of this possible).

What I did was to add a wildcard entry:

*.testservers.mydomain

And then use that as my TLD_SUFFIX:

TLD_SUFFIX=testservers.mydomain

And then it’s just a matter of adding virtual hosts in devilbox:

wwwtest1.testservers.mydomain
wwwtest2.testservers.mydomain

Etc.

But in example, how does the test1.com link to your www.test1.testserver.mydomain and the test2.net to www.test2.testserver.mydomain ?

Do you mean how to point a “real” domain like “test1.com” to devilbox, instead of just a subdomain? Erm… I didn’t do it, since I didn’t need it. I’m not setting this for production. I’m just setting up test servers for my team to work together (this is why I need a VPS instead of a Docker stack running on my own computer). I haven’t researched how would it work with a top-level domain.

oh! ok then :sweat_smile: