praisedpk
By:
praisedpk

Virtual Hosts not working for additional domains

April 8, 2015 2k views
Apache Getting Started DNS Ubuntu

I am running Virtualmin on Ubuntu 14.04 droplet. I have a domain bought from amazon route53 and all DNS work is left to it. I am not using digitalocean or Virtualmin's DNS features.

Ok, so the problem is, when I use the parent domain example.com on my droplet, it works fine, but when I create a subdomain on Route53 and point it to the same IP address the parent domain has, and then create a virtual host on droplet, it does not work.

I have tested DNS settings through 3rd party tools, and seems like it is properly resolving to the given IP. On the server, when I try to access http://sub.domain.com/ it gives "Server Not Found" error.

When I check the host via internal URL, https://example.com:10000/virtual-server/link.cgi/1.1.1.1/http://www.sub.domain.com/ , it works and shows the index file.

What am I doing wrong here?

3 comments
  • What is the content of the virtualhost configuration being written in /etc/apache2/sites-enabled/ when you create your new virtualhost?

  • This is vhost file for main domain. http://pastebin.com/B7SpkZ6b and this is for subdomain: http://pastebin.com/RMwLHdBH

    By the way, don't know what I did to the configuration, accessing sub.domain.com either way now shows 403 Forbidden "You don't have permission to access / on this server." error.

    Can you please guide me what was the reasons for this error, and what was happening behind the scene when the hosts were creating problems as mentioned in my question above. Thanks

  • Ok, I have removed the 403 error. It was because the directory listing was prevented. But what was the reason of previous problem? I am pretty sure it will create problem on my next droplet too.

Be the first one to answer this question.