Several domains -> 1 Virtual host : CNAME or ServerAlias ?

January 19, 2014 7.5k views
I have some virtual hosts / domains On 1 Droplet and need to bind several domans to 1 of vhosts Let it be I see 2 options: 1. Add to /DNS menu domain with CNAME records: CNAME CNAME and also add to /DNS domains and just with A records and set digitalocean nameservers to domain names 2. Add to /DNS domains ,, with A records In httpd.conf: ServerName ServerAlias ServerAlias Is it correct? What would be better?
1 Answer

Option 1 will only work if your website is being served without name based virtual hosting (browse your site using its IP address; if you can see your site, it is name based virtual hosting and therefore this will work).

Option 2 will work fine in case you are using name based virtual hosting.

However, please note that you can not set CNAME on root domain ( CNAME to, but only for its hostnames.
Have another answer? Share your knowledge.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!