Page 1 of 1

Apache won't bind to vhost ports

PostPosted: 05. April 2011 21:23
by Grumpy
Hello,
I've come across a peculiar problem that's really bothering me. I've setup multiple vhosts by using different ports. However, I can only get 3 of them to work for some reason.

Below is my vhost configuration. Strangely the ports 8000 and 8004 doesn't work. I've tried bunch of random other ports as well, such as 9989, 8055, etc. But none of them works except 8001~8003. I've stared at my configuration for an hour to see if I made any typos... and doesn't seem like it either.
When I create the dummy host from the example, although the port 80 is already bound, it still doesn't seem to work!!!
Code: Select all
<VirtualHost *:80>                #DOESN'T WORK
    ServerAdmin postmaster@dummy-host2.localhost
    DocumentRoot "C:/xampp/htdocs/something"
    ServerName dummy-host.localhost
    ServerAlias www.dummy-host.localhost
</VirtualHost>
<VirtualHost *:8000>          #DOESN'T WORK
    ServerAdmin postmaster@dummy-host.localhost
    DocumentRoot "C:/xampp/htdocs/-----------"
    ServerName localhost:8000
</VirtualHost>
<VirtualHost *:8001>              #WORKS
    ServerAdmin postmaster@dummy-host.localhost
    DocumentRoot "C:/xampp/htdocs/-----------"
    ServerName localhost:8001
</VirtualHost>
<VirtualHost *:8002>              #WORKS
    ServerAdmin postmaster@dummy-host.localhost
    DocumentRoot "C:/xampp/htdocs/-----------"
    ServerName localhost:8002
</VirtualHost>
<VirtualHost *:8003>            #WORKS
    ServerAdmin postmaster@dummy-host.localhost
    DocumentRoot "C:/xampp/htdocs/-----------"
    ServerName localhost:8003
</VirtualHost>
<VirtualHost *:8004>           #DOESN'T WORK
    ServerAdmin postmaster@dummy-host.localhost
    DocumentRoot "C:/xampp/htdocs/-----------"
    ServerName localhost:8004
</VirtualHost>

I can add more random ports to the list, but nothing else beyond 8001~8003 seem to work!!!

And here's a snippet of my netstat -anop TCP that shows nothing is listening on port 8000 and 8004.
Code: Select all
  TCP    0.0.0.0:7511           0.0.0.0:0              LISTENING       1200
  TCP    0.0.0.0:7512           0.0.0.0:0              LISTENING       1244
  TCP    0.0.0.0:8001           0.0.0.0:0              LISTENING       2892                       #8001 to 8003 is here as it should be. Where's 8000 and 8004???
  TCP    0.0.0.0:8002           0.0.0.0:0              LISTENING       2892
  TCP    0.0.0.0:8003           0.0.0.0:0              LISTENING       2892
  TCP    0.0.0.0:10243          0.0.0.0:0              LISTENING       4
  TCP    0.0.0.0:11211          0.0.0.0:0              LISTENING       2044
  TCP    0.0.0.0:33229          0.0.0.0:0              LISTENING       5500


I would be very grateful if anyone could enlighten me on the problem of my setup.
Thank you.

Re: Apache won't bind to vhost ports

PostPosted: 06. April 2011 05:44
by Altrea
You need to define a LISTEN directive in your \xampp\apache\conf}httpd.conf file for every port you want to use with your Apache.

Re: Apache won't bind to vhost ports

PostPosted: 06. April 2011 05:49
by Grumpy
Thank you so much~!
I guess it was rather stupid of me considering that I did add 8001~8003 to that listening list. :x :oops:

But shouldn't the port 80 still work?