Apache: Multiple Virtual Hosts on REMOTE server

apache-2.2virtualhost

I have a remote server with IP address 10.72.254.248, I want to set up multiple virtual hosts on this server by giving different ports for each virtual host.

my httpd.conf:

Listen 80
Listen 3333

NameVirtualHost *:80
NameVirtualHost *:3333

<VirtualHost *:80> 
     DocumentRoot "/path/to/site1/" 
     ServerName *:80
</VirtualHost>

<VirtualHost *:3333> 
     DocumentRoot "/path/to/site2/" 
     ServerName *:3333
</VirtualHost>

If no port specified, it will hit site1 (port 80)
When I go to 10.72.254.248 or 10.72.254.248:80 it opens site1 successfully

But when I try 10.72.254.248:3333 it doesn't work.

Is the issue to do with the syntax? or maybe with /etc/hosts file? or firewall?

Please help

EDIT:

When I try to connect to 10.72.254.248:3333, I get the following error message:

Can't connect to server 10.72.254.248:3333

Best Answer

Check netstat -an and make sure Apache is listening on port 3333. Check nothing else is listening instead. If it is, it's most likely a firewall issue (iptables -L and look for a rule allowing port 3333).