How to setup subdomain on multiple virtual host vps?

  • Posted September 3, 2015
  • Apache

I’m on an ubuntu server and using apache. I’ve set several domains on my droplet but when I tried to access it is redirected to, as so the other

without any CNAME I can access the other sites normally. But then I want to create an A record type subdomain, to access root directory /var/www/test. And its the same problem again, it shows the page of

My setting is, 1800 IN CNAME
* 1800 IN CNAME 1800 IN A

for the conf file I am creating new file on sites-available then add it with a2ensite…

Any help is appreciated, thanks


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

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Take a look at your apache.conf (CentOS: httpd.conf), located in /etc/apache2/conf or /etc/httpd/conf. Almost at the end file you will find something about VirtualHost (NameVirtualHost to be precise). Perhaps this is still commented? If so, please uncomment en restart apache.