I have followed this guide https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-centos-6
I have a website in /var/www/html. I followed the guide and i have the main site setup as the first virtual host. I can access the website fine so i havnt broken it. I have added the following to the bottom of /etc/httpd/conf/httpd.conf
<VirtualHost *:80> ServerName www.example.com ServerAlias example.com DocumentRoot "/var/www/html" </VirtualHost>
I want to be able to add some prefix domains. m.example.com, forum.example.com etc. To test this i have tried setting up a second virtual host for the same directory but with a different server name. This should link to the same website, but instead i get a page cannot be displayed error with the following “ERR_NAME_NOT_RESOLVED”
<VirtualHost *:80> ServerName m.example.com DocumentRoot "/var/www/html" </VirtualHost>
I have set the following 2 variables in the httpd.conf file
ServerName www.example.com:80 NameVirtualHost *:80
You need to add DNS records for the new vhosts. This is done wherever your authoritative DNS service for this domain is hosted.