Page 1 of 1

Need Help with virtual hosts

PostPosted: 04. November 2007 03:00
by skipsbro
Hello, I am a bit new at the idea of apache Virtual Hosting, but I would like to give it a whirl. I am running xampp on a ubuntu 7.04 server and I currently have a listen in httpd.conf like this

Listen 8000

and in httpd-vhosts.conf like this (for my secondary domain, jaksalad.com)

<VirtualHost *:8000>
ServerAdmin admin@feistyhosts.com
Document Root /www/jaksalad
ServerName jaksalad.com *.jaksalad.com
ErrorLog logs/jaksalad.com-error_logs
CustomLog logs/jaksalad.com-access_logs common
</Virtual Host>

However, when you try to visit http://jaksalad.com:8000 (I use port 8000 because Verzion blocks outbound port 80), you get the server index (Currently set to /var/www/)

What am I doing wrong?

Re: Need Help with virtual hosts

PostPosted: 04. November 2007 06:50
by skuipers
You should specify the following in httpd-vhosts.conf:

NameVirtualHost *:8000

#
# Default virtual host
#

<VirtualHost *:8000>
ServerName your_primary_domain
DocumentRoot /var/www
ErrorLog your_error_log_location
CustomLog your_access_log_location
<Directory /var/www>
Options Includes MultiViews ExecCGI
AddHandler cgi-script .cgi .exe .pl
Order allow,deny
Allow from all
</Directory>
</VirtualHost>


#
# Virtual host added for secondary domain
#

<VirtualHost *:8000>
ServerName *.jaksalad.com
DocumentRoot /www/jaksalad
ErrorLog logs/jaksalad.com-error_logs
CustomLog logs/jaksalad.com-access_logs common
<Directory /www/jaksalad>
Options Includes MultiViews ExecCGI
AddHandler cgi-script .cgi .exe .pl
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

This works for me anyhow. Of course the specifications in <Directory>..</Directory> are just an example; please adjust according to your own needs.

Do not forget to restart Apache after having made the modifications.

PostPosted: 04. November 2007 08:14
by skipsbro
I have done what you told me, and it did not work. Is there anything else I'm missing? Even if its obvious, It's like me to over look the little details.

PostPosted: 04. November 2007 10:31
by skuipers
Did you make a change in /opt/lampp/etc/httpd.conf?

# Virtual hosts
#Include etc/extra/httpd-vhosts.conf

should become

# Virtual hosts
Include etc/extra/httpd-vhosts.conf

PostPosted: 04. November 2007 17:49
by skipsbro
ah, thank you, that is what I had done wrong.