Forum

cannot make virtual host work & how can i display a server alias like

charles
3 August 2007, 13:24
what did i do wrong? why on earth cant i browse my 2nd virtual site?
and if i declare www.website.com,i cannot browse to it using http://website.com only, why is that?

Hostname = 127.0.0.1
WebsiteRoot = /var/www/blank
StartFile = index.html


VirtualHost {
Hostname = www.bugzillaExample.com
WebsiteRoot = /var/www/bugzilla222
StartFile = index.cgi
AccessLogfile = /var/www/kigwa/access.log
ErrorLogfile = /var/www/kigwa/error.log
ExecuteCGI = yes
}

VirtualHost {
Hostname = www.website2.org
WebsiteRoot = /var/www/rc2k
StartFile = index.php
}
Hugo Leisink
3 August 2007, 13:53
First of all, you have to make sure all the hostnames (www.website2.org, website.com, etc) resolve to the IP address of your webserver.

In the www.website2.org, you want to use PHP. You have to tell Hiawatha about how to handle PHP files. Use the CGIhandler option for that. You also have to use 'ExecuteCGI = yes' in the second virtual host, to tell Hiawatha to execute CGIs.

If you want to use an URL without www. just add the name to the Hostname option. You can also use a wildcard: *.website.com. Note that the first hostname you specify cannot contain a wildcard.

You configuration file should be like this:
Hostname = 127.0.0.1
WebsiteRoot = /var/www/blank
StartFile = index.html

CGIhandler = /usr/bin/php-cgi:php

VirtualHost {
Hostname = www.bugzillaExample.com
WebsiteRoot = /var/www/bugzilla222
StartFile = index.cgi
AccessLogfile = /var/www/kigwa/access.log
ErrorLogfile = /var/www/kigwa/error.log
ExecuteCGI = yes
}

VirtualHost {
Hostname = www.website2.org, website2.org
WebsiteRoot = /var/www/rc2k
StartFile = index.php
ExecuteCGI = yes
}


Make sure you have php-cgi installed. If php-cgi is not located in /usr/bin, adjust the CGIhandler setting.
charles
7 August 2007, 05:50
Thank you your webserver rocks!!
Hugo Leisink
7 August 2007, 09:24
Thanks, that's good to hear

If you got it all working, then you should take a look at how to configure Hiawatha to use PHP via FastCGI [projects.leisink.org]. FastCGI is 15 times faster then normal CGI, so it's worth trying. In Hiawatha, it's really easy to configure.
charles
9 August 2007, 10:52
FastCGIserver {
FastCGIid = PHP4
ConnectTo = localhost:2005 <--what does this mean?
Extension = php, php4,php5
}


ConnectTo - should it be like that or should i replace it with the name of the virtual domain where i want the fastcgi to be active?
Hugo Leisink
9 August 2007, 11:21
The answer can be found in the HOWTO [projects.leisink.org] page.
This topic has been closed.