virtual hosting
I need help with name based virtual hosting. When I configure the virtualhosts for one domain it doesn't use the default page that I requested. Both domains visit the same page and thats not what I want. I was wondering whats the right configuration to put in the httpd.conf file for name based virtual hosting. I need basic configuration to be added to the file.
|
Take a look at the examples here:
http://httpd.apache.org/docs/vhosts/name-based.html If you still have problems then try posting the relevant part of httpd.conf so we can see your current configuration. |
I am still having problems, here is my virtual host configuration.
NameVirtualHost 192.168.1.2 <VirtualHost www.setenv.gotdns.org> DirectoryIndex /var/bin/index.htm NameVirtualHost setenv.gotdns.org:80 DocumentRoot /var/bin ServerName setenv.gotdns.org ErrorLog logs/error_1.log TransferLog logs/transfer_1.log </virtualhost> |
You need to made a vhost for each of the hosted pages. Try not to write the vhost name in <Virtual Host <here>> section, but instead write it as that:
<Virtual Host *:80> #if you run apache at port 80 ServerName www.setenv.gotdns.org ... other options... drop ServerName... </Virtual Host> Respective for the other vhost. This works in Apache 1.3.27 |
Virtual hosts still do not work. This is what I have pasted into my httpd.conf file, check it out.
NameVirtualHost 192.168.1.2 <VirtualHost *:80> DirectoryIndex /var/bin/index.htm DocumentRoot /var/bin ServerName setenv.gotdns.org ErrorLog logs/error_1.log TransferLog logs/transfer_1.log </virtualhost> |
heres mine: (httpd.conf)
# # Use name-based virtual hosting. # NameVirtualHost *:80 <VirtualHost *:80> ServerAdmin you@yourdomain.com ServerPath /var/bin DocumentRoot /var/bin/html ScriptAlias /cgi-bin /var/bin/cgi-bin DirectoryIndex index.html index.htm index.php ServerName www.yourdomain.com ErrorLog /var/log/httpd/error_log CustomLog /var/log/httpd/access_log common </VirtualHost> <VirtualHost *:80> ServerAdmin you@yourdomain2.com ServerPath /var/bin2 DocumentRoot /var/bin2/html ScriptAlias /cgi-bin /var/bin2/cgi-bin DirectoryIndex index.html index.htm index.php ServerName www.yourdomain2.com ErrorLog /var/log/httpd/error_log CustomLog /var/log/httpd/access_log common </VirtualHost> enjoy :) |
Setenv02: you nead at least 2 <vritual host> sections - one for each vhost. There isn't meaning to make only one vhost, right? :)
|
All times are GMT -5. The time now is 07:59 PM. |