Andrew wrote:
> Help!,
> i ahve been struggeling with this problem for hours now, and have
> tried everything that i can find and think of!, i have a static ip and
> go through a modum/router and i think that i have sucessfuly allowed
> the ports to come through.
> The problem:-
> i have two vhosts, hoping that the first will be the default, when i
> ran a Vhost-dump i got:-
>
> VirtualHost configuration:
> *.*.*.*:80 is a NameVirtualHost
> default server www.MyDefaultServer.com
> (/(somewhere)/httpd.conf:724)
> port 80 namevhost www.MyDefaultServer.com
> (/(somewhere)/httpd.conf:724)
> port 80 namevhost www.MyPage.com
> (/(somewhere)/httpd.conf:751)
> wildcard NameVirtualHosts and _default_ servers:
> _default_:443 new.host.name (/(somewhere)/ssl.conf:90)
> (98)Address already in use: make_sock: could not bind to address
> 0.0.0.0:443
> no listening sockets available, shutting down
>
> Also, no matter what order i put the two hosts, when i call MyPage.com
> it automaticaly goes to the index.html page, when i call the
> MyDefaultServer.com page, it displays the index.html page of
> MyPage.com, further more when i type in MyDefaultServer.com/index.html
> it displays the right page!.
> What could i be doing wrong?
> Andrew
Are you using Apache 1.3.x ?
I am - and I've had similar problems with VirtualHosting before - I read
this solution somewhere, and it works for me:
In your httpd.conf file, check the following
#Listen 3000
#Listen 12.34.56.78:80
NameVirtualHost *
Therefore, the above has two lines that are disabled (the '#' character
does this in the config file).... The NameVirtualHost has a single
asterix, not an IP address in it.
Lastly, at the very end of my httpd.conf file I have
include "/data/www/config"
Then, in /data/www/config I have individual files for each one of my
virtual hosts - each has a specific configuration specific to that
domain. Any file that sits in that directory is taken as configuration
directives and are read as listed. I called my default file _default so
when you do an ls -l it gets listed first... and started/answered first
by the server for client requests.
My /data/www/config/_default file looks like the following:
<VirtualHost *>
ServerName
www.mydomain.com
DocumentRoot /data/www/websites/mydomain.com/htdocs
ErrorLog /data/www/logs/mydomain.com-err.log
CustomLog /data/www/logs/mydomain.com-access.log combined
</VirtualHost>
You can have more than one configuration directive in each file, I do
for some domains which have several sub-domains - The advantage to this
method is I have all directives for a single domain in a single file...
and any changes I do relate specifically to that domain, and not
globally... However, any changes to the parent httpd.conf file will of
course, make global changes.
One last thing - I should stress that any files you have sitting under
the directory you specify in the 'include' directive is taken to be a
configuration directive thus you might find, like I have more than once,
is that if you're editing a config file with 'vi' and restart Apache,
that Apache fails to start - This can be because a ".swp" (vi swap file)
exists in there, and it should clean up if you exit vi and then try
start Apache again.
I hope something above there helps you...
randelld