I write the answer below to also help others…it goes probably a lot further than it needs to to answer your level of knowledge. However, i personally get sick of reading reponses to questions on forums that essentially do zero to help other readers fully understand the subject. So below is a rather long answer…
When you say "i pointed the DNS name servers to your Virtualmin>Virtual Server?
The fact you are saying that you can only browse your website by the server external ip address tells me that the dns is not resolving. The reason that the “webserver external ipAddress method” works is illustrated using the following example…
Pretend you are a postman deliverying a letter to a street address.
Mr Postman knows how to find a house because the country, state, town, street, and number are widely published details. What the postman does not necessarily know, is who actually lives at the particular residence he is delivering letters/parcels to. He reads this often on the front of the letter itself.
On a webserver, these two (ie street address and residents name) are linked via a text file known as a vhosts file. This file which is stored on the webserver, links the website ip address with your domain name (some websites have their own dedicated ip address, others just use the main webhosting server external ip address). In your case, because you can browse the website by ip address, my assumption is, the vhosts file is likely working (of course a real test would be if you are able to access multiple virtualmin>virtual servers on your system using the external ip address.
So, In the event you have checked your vhosts is working correctly and apache is using it as it should, and things are still not working…the following is where i would head next.
If your vhosts file is working, then the problem would be that there is nothing linking your registrar nameserver with your hosting servers ip address. Essentially this means, a letter comming to australia from America hasnt a clue what your suburb and postcode are…and therefore hasnt a clue what post office to send it to in in your district…even though your local post office ( or “vhosts file”) knows where your street and house number are and that “you live at that street address” on the webhosting system. Essentially this means that there is a break in the chain and the “the letter” never gets delivered (ie “error name not resolved”).
You are essentially bypassing the dns resolution by typing in directly the street address manually yourself. Google already knows the country, state, and suburb of your webserver external ip address, because ip addresses are actually purchased by service providers and then allocated on their own systems accordingly with those kinds of details…which are then widely advertised across the “web universe”.
The website names that match up with those external (or public) ip addresses, of which there can be hundreds “per ip address”, are most definately not automatically known by browsers/search engines. Hence the need to match names with ip addresses each time a new website is created (taking a little “writers liberty” with last statement…but you get the idea)
The most obvious fix options to your problem are outlined as below: (i say obvious because these are the most common ways of solving the most common reason for your problem)
- Have you setup and registered your Webmin Bind DNS Server to act as an internet name server? This requires at least 4 considerations…
a. You have to register your Webmin/Virtualmin web server as a Nameserver (this is done via your domain name at your registrar)
b. configure Bind to function on WEbmin/Virtualmin (should happen automatically on install if i remember correctly)
c. Check the dns records on your bind dns for said domain are correct (should also be pretty automated in Virtualmin)
d. you need to have setup at least 2 dedicated or VPS nameserver instances with “different” ip addresses for it to work consistently and satisfactorily
EDIT… i forgot to mention one important thing about registering your webmin server a nameserver and using its built in Bind DNS. Dont confuse this with one of your virtualmin>virtual servers.
You actually have to register your webmin server itself as a nameserver with the registrar of its own domain name!
So if for example your server was called server1.fancy.com , then this is the nameserver that needs to be registered in the registrar domain management console for domain called fancy.com.
Normally, nameservers use the prefix ns1, or ns2 or ns3 etc. In the case where you are using your webhosting server as one of the (2 required) nameservers, you might instead use the prefix server1 etc.
Also, most of the console i use regularly do not use the same area for registering a nameserver and ip address to it. This is usually setup as a “custom namesever” for the server1.domain.com (google this if needed, its a whole other discussion on its own)
There is a far easier alternative to the above…
-
Forget about using Bind DNS on your server. If you are simply hosting your own website/s you honestly do not need it and in my humble opinion, the bind example above, serves no purpose other than educating oneself how to use dns, and gives added workload and stress in setting it up. (so for a new setup, you can accept the default virtualmin install that automatically confugures Bind DNS, let it run in the background essentially doing nothing…turn it off if you want too, or just leave it as is after install and figure Bind DNS out later without causing any problems to your website)
-
Log into your registrar zone file records and add the following…
www - - A (record type) - TTL 8600
your domain.com - - A (record type) - TTL 8600
The above 2 “A records” are all that is required at your registrar to pointing at your Webmin Server External IP Address in order to bring website online via its domain.com.
Once you have website online, you may wish also to setup ftp and email. These two below wil need to be added as records at your registrar
ftp.yourdomain.com - A (record type) -
mail.yourdomain.com - mx (Record type) -
hope this helps
kind regards
Adam