Sample Header Ad - 728x90

Setting up domain with multiple servers

3 votes
1 answer
1116 views
I am setting up a small web hosting service for my clients. I have my dedicated server which will be the shared server to host clients websites using WHM/cPanel. I have a separate VPS server that I want to use for hosting my own sites, so that in the event the shared server goes down my clients can still reach me to open tickets, etc. I have set up my business domain name on my shared server.  I created glue records within [Namecheap](https://en.wikipedia.org/wiki/Namecheap "domain name registrar") to set up ns1/ns2 so that my shared server can be reached using mydomain.com and can forward domains using ns1.mydomain.com and ns2.mydomain.com. What I want to do now is forward www.mydomain.com and mydomain.com to my VPS so that I can use it to host my main website. I have edited the DNS zone within WHM/cPanel to point the @ and www 'A Record' to my VPS IP address. Now when I try to visit www./mydomain.com it shows the Apache 2 test page as if vhosts weren't working. I have set up VPS before and never had this issue so I'm thinking either a problem with the DNS A/www records or I have missed something when configuring the VPS. Here is my vhosts within httpd.conf: (CentOS 6.5)
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
...

    ServerAdmin my@email.com
    DocumentRoot /var/www/html
    ServerName vps.mydomain.com
    ServerAlias 91.227.220.159



    ServerAdmin my@email.com
    DocumentRoot /var/www/username/public_html
    ServerName www.mydomain.com
    ServerAlias mydomain.com
If this was working then vps.mydomain.com and server IP should show the default apache page and mydomain.com should show the site located at /var/www/username/public_html. I appreciate this could be a hard question to answer but I am pulling my hair out.  Is there anything blatant obvious I could have missed? Is the way I'm setting up the domain the best route to take? The idea is that if my clients visit me at mydomain.com they'll be taken to my website on the VPA, but they can also use ns1.mydomain.com and ns2.mydomain.com to point domain to the shared server and hostname.mydomain.com for things like SSL when using IMAP, would there be a better way to achieve this? Maybe pushing domain back to Namecheap and managing DNS from there?
Asked by Goodbytes (141 rep)
Oct 26, 2014, 08:03 PM
Last activity: Oct 18, 2020, 11:04 PM