Thursday, February 15, 2018

apache 2.2 - Can't make virtual host working




I have to create a virtual host on a server which, previously hosted a single website (domain name). Now I'm trying to add a second domain on this server (using the same nameserver). What I've done so far:



Initially there was no virtual host so I've made one for the second domain:



NameVirtualHost *:80

DocumentRoot /var/www/bla
ServerName www.blabla.com
ServerAlias blabla.com


Order deny,allow
Allow from all
AllowOverride All




Because nothing happend, I changed the DocumentRoot of the apache server to /var/www (initially was the root document of the first website -/var/www/html) and created a virtual host for the first domain too:



   

DocumentRoot /var/www/html
ServerName www.first.com
ServerAlias first.com

Order deny,allow
Allow from all
AllowOverride All





In this case, first.com is working ok, but bla.com not.
When I ping blabla.com I get the "unkown host" response. What am I doing wrong? Do I have to modify something in the DNS settings too? Thank you.


Answer



Yes, if ping isn't resolving the name, then you'll need to configure DNS for that domain (or a hosts file locally, if you're just trying to test) to point to your Apache server.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...