I have a website "example.com" hosted on a provider that allows me to manage my own DNS. I want example.com to point to the provider's IP address but I want "subdomain.example.com" to point on my own apache installation on a VPS I have with, of course, a different IP address.
This is what I have done:
I set the A redirect of example.com to the provider's machine (let's say IP is 1.2.3.4)
I set the A redirect of subdomain.example.com to my own VPS (let's say IP is 5.6.7.8)
Then I connected to my VPS server and changed my apache files like this:
httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "C:\xampp\htdocs\mydirectory\mysubdirectory"
ServerName subdomain.example.com
<Directory "C:\xampp\htdocs\mydirectory\mysubdirectory">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
hosts file, I add:
127.0.0.1 subdomain.example.com
However when I ping subdomain.example.com I get an "Unknown host error", nor I can access from my own VPS to the files by browsing that URL.
Am I missing something important?