January 12, 201115 yr Hi, I would like to ask you, how could I add multiple virtual hosts to my apache server. I have edited the conf/extra/httpd-vhosts.conf file, and I have added the domain names to my hosts file in windows. Oh I use vista. My httpd-vhosts.conf file looks like this: <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot C:\xampp\xampp\htdocs ServerName localhost <Directory "C:\xampp\xampp\htdocs"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> NameVirtualHost 127.0.0.1 <Directory "C:\xampp\xampp\testprojects "> Order Deny,Allow Allow from all </Directory> <VirtualHost 127.0.0.1> DocumentRoot C:\xampp\xampp\testprojects\acm ServerName acm </VirtualHost> <VirtualHost 127.0.0.1> DocumentRoot C:\xampp\xampp\testprojects\komprador2010 ServerName komprador2010 </VirtualHost> What my problem is: I can see only the website that comes first. If I type the second in the browser, the first one comes. eg.: now acm comes firts, When I type in acm.hu, it appears. Great! When I type in komprador2010.hu, acm appears. When I change the order in the vhosts file, so that komprador comes firts, I will se only komprador even if I type in acm. localhost works fine. What can be wrong?
January 12, 201115 yr Hi, I would like to ask you, how could I add multiple virtual hosts to my apache server. I have edited the conf/extra/httpd-vhosts.conf file, and I have added the domain names to my hosts file in windows. Oh I use vista. My httpd-vhosts.conf file looks like this: <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot C:\xampp\xampp\htdocs ServerName localhost <Directory "C:\xampp\xampp\htdocs"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> NameVirtualHost 127.0.0.1 <Directory "C:\xampp\xampp\testprojects "> Order Deny,Allow Allow from all </Directory> <VirtualHost 127.0.0.1> DocumentRoot C:\xampp\xampp\testprojects\acm ServerName acm </VirtualHost> <VirtualHost 127.0.0.1> DocumentRoot C:\xampp\xampp\testprojects\komprador2010 ServerName komprador2010 </VirtualHost> What my problem is: I can see only the website that comes first. If I type the second in the browser, the first one comes. eg.: now acm comes firts, When I type in acm.hu, it appears. Great! When I type in komprador2010.hu, acm appears. When I change the order in the vhosts file, so that komprador comes firts, I will se only komprador even if I type in acm. localhost works fine. What can be wrong? Your not setting the domain hostname, eg, domain.com or ServerName: www.domain.com
January 12, 201115 yr I don't know much about apache running on windows but try this... NameVirtualHost * <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot C:\xampp\xampp\htdocs ServerName localhost <Directory "C:\xampp\xampp\htdocs"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot C:\xampp\xampp\testprojects\acm ServerName acm <Directory "C:\xampp\xampp\testprojects\acm"> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> </VirtualHost> <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot C:\xampp\xampp\testprojects\komprador2010 ServerName komprador2010 <Directory "C:\xampp\xampp\testprojects\komprador2010"> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> </VirtualHost>
January 13, 201115 yr Author I don't know much about apache running on windows but try this... NameVirtualHost * <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot C:\xampp\xampp\htdocs ServerName localhost <Directory "C:\xampp\xampp\htdocs"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot C:\xampp\xampp\testprojects\acm ServerName acm <Directory "C:\xampp\xampp\testprojects\acm"> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> </VirtualHost> <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot C:\xampp\xampp\testprojects\komprador2010 ServerName komprador2010 <Directory "C:\xampp\xampp\testprojects\komprador2010"> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> </VirtualHost> Thanks Jock! I have tried it, now my httpd-vhosts looks like this: NameVirtualHost 127.0.0.1 <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot C:\xampp\xampp\htdocs ServerName localhost <Directory "C:\xampp\xampp\htdocs"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> <VirtualHost 127.0.0.1> ServerAdmin webmaster@localhost DocumentRoot C:\xampp\xampp\testprojects\komprador2010 ServerName komprador2010 <Directory "C:\xampp\xampp\testprojects\komprador2010"> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> </VirtualHost> <VirtualHost 127.0.0.1> ServerAdmin webmaster@localhost DocumentRoot C:\xampp\xampp\testprojects\acm ServerName acm <Directory "C:\xampp\xampp\testprojects\acm"> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> </VirtualHost> I have tried * as hostname, but it does not work. if I put <VirtualHost *:80> to the virtual hosts, then my 2 sites are redirected to komprador2010.hu/xampp and normal localhost appears. Is somethis wrong with my setting somewhere else?
January 13, 201115 yr Author Thanks Jock! I have tried it, now my httpd-vhosts looks like this: NameVirtualHost 127.0.0.1 <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot C:\xampp\xampp\htdocs ServerName localhost <Directory "C:\xampp\xampp\htdocs"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> <VirtualHost 127.0.0.1> ServerAdmin webmaster@localhost DocumentRoot C:\xampp\xampp\testprojects\komprador2010 ServerName komprador2010 <Directory "C:\xampp\xampp\testprojects\komprador2010"> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> </VirtualHost> <VirtualHost 127.0.0.1> ServerAdmin webmaster@localhost DocumentRoot C:\xampp\xampp\testprojects\acm ServerName acm <Directory "C:\xampp\xampp\testprojects\acm"> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> </VirtualHost> I have tried * as hostname, but it does not work. if I put <VirtualHost *:80> to the virtual hosts, then my 2 sites are redirected to komprador2010.hu/xampp and normal localhost appears. Is somethis wrong with my setting somewhere else? Ok, now I have added the 2 pieces of advice together! I have to put acm.hu and komprador2010.hu as serverName, as this is what I have set up after all!!! Thanks guys!! It works now!
Create an account or sign in to comment