I am having problems in implementing the virtual hosts here in my server. I have this one cloud dev server: Amazon Linux AMI release 2013.03 (based on RHEL like CentOS) with Apache 2.2.25 installed and I'm trying to create 2 virtual hosts: test-kalc.tk and test2-kalc.tk.
If I go to test-kalc.tk, the expected output should be "Hello from test-kalc.tk!" and I have no problems seeing that. The output for test2-kalc.tk should be "Hello from test2-kalc.tk!" but I don't know why every time I go to test2, I still see the same page from my first host.
I googled about this and checked other forums out there but I still couldn't find the answer to this.
Here's my /etc/httpd/conf/httpd.conf:
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /var/www/test-kalc.tk
ServerName test-kalc.tk
ServerAlias test-kalc.tk *.test-kalc.tk
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /var/www/test2-kalc.tk
ServerName test2-kalc.tk
ServerAlias test2-kalc.tk *.test2-kalc.tk
</VirtualHost>
I've already tried changing *:80 to * and also tried using the IP address (private/public) but that didn't help me either.
The hosts were also included in /etc/hosts.
127.0.0.1 localhost localhost.localdomain test-kalc.tk test2-kalc.tk
Here are the other info that you might need:
[root@web-server-dev html]# httpd -S
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80 is a NameVirtualHost
default server test-kalc.tk (/etc/httpd/conf/httpd.conf:1013)
port 80 namevhost test-kalc.tk (/etc/httpd/conf/httpd.conf:1013)
alias test-kalc.tk
wild alias *.test-kalc.tk
port 80 namevhost test2-kalc.tk (/etc/httpd/conf/httpd.conf:1018)
alias test2-kalc.tk
wild alias *.test2-kalc.tk
Syntax OK
[root@web-server-dev html]# service iptables status
iptables: Firewall is not running.
[root@web-server-dev html]# netstat -apn | grep 80
tcp 0 0 :::80 :::* LISTEN 20007/httpd
Let me know if you need anything else.
Thanks in advance!