Problem with domains managed on the same IP

OS: Debian 10 | Webmin: 1.984 | Virtualmin: 6.17-3 | node v16.14.2 | curl (7.64.0-4+deb10u2)

I’m not sure if this is the right forum. I apologize if it isn’t.

I use virtualmin and I have several virtualhosts with their respective domains. The server is in my house and has a private IP of 192.168.1.8, as a public IP I have a dynamic IP that I update when the electricity goes out (very rarely)

One of the domains, domain A, is the primary domain. This means that if from my local network I search for 192.168.1.8 domain A appears. This can be changed in Virtuamin → Server Configuration → Website Options → Default website for IP address

All domains are working properly and all websites hosted and managed by virtualmin are functional.

The problem came when I wanted to use puppeteer to take screenshots of some of my web pages. It always failed. It was able to capture the entire internet and my domain A, but it was unable to access domains B, C and D

I did tests to make sure. If from the terminal of my own server (debian) I try to curl domain A, I get the expected response, but if I try it with the other domains B, C and D, I get an error 7 for timeout after a good time waiting no results

If I try to ping domain A from my own server I get: 64 bytes from domainA.com (192.168.1.8): icmp_seq=1 ttl=64 time=0.132 ms

If I try to ping domains B, C and D from my own server, I get: 64 bytes from 175.red-79-148-220.dynamicip.rima-tde.net (79.148.220.175): icmp_seq=3 ttl =57 time=9.76 ms
NOTE: 79.148.220.175 is what it really returns, and I confirm that it is not my public IP

I would like to know why this happens and how I can solve it. I would like to be able to use curl and puppeteer on my own domains from the server itself. Some help?

Thanks


UPDATE
Hi guys, it seems that I have already solved the problem.

We have to go to:

Networking → Networking configuration → Host Addresses

And add the domains in Hostnames

With that it is solved. Confirmed.

Well, I take this opportunity to ask. Is there a possibility to automate this every time you create a virtualhost? It would be interesting not to have to be adding the domains manually, and I don’t know if it’s possible

There are pre and post change hooks in Virtualmin. You can run any script you want every time you make a change (including creating a domain).

https://www.virtualmin.com/documentation/developer/prepost/

1 Like

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.