Page 1 of 1

typing the ip adress goes to xampp index!

PostPosted: 03. June 2009 00:25
by utan
Ok so i have xampp runing and its wonderful , i have setup the vhost directive, this is how it looks like:

<VirtualHost *:80>
ServerAdmin localhost@localhost.com
DocumentRoot /opt/lampp/htdocs
ServerName localhost
ServerAlias localhost
ErrorLog logs/localhost-error_log
CustomLog logs/localhost-access_log common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin website@website.com
DocumentRoot /opt/lampp/htdocs/website1.com
ServerName http://website1.com
ServerAlias website1.com
</VirtualHost>
<VirtualHost *:80>
ServerAdmin website2@website2.com
DocumentRoot /opt/lampp/htdocs/website2
ServerName http://website2.com
ServerAlias http://www.website2.com
</VirtualHost>

now the issue is that if you type the IP adress it goes to xampp directory, it wont work cuz the security placed in xampp is good, but then if you type http://www.website2.com it goes to xampp index. i have setup the dns adress fine,
I have yahoo dns servive and this is how it looks like:
A Record *.website2.com ip Edit | Delete
A Record website2.com ip ip Edit | Delete
A Record www.website2.com ip

what i am missing that www.website2.com or http://www.website2.com goes to xampp ,
should i make another <virtualhost>
with server name www.website2.com
</virtualhost>
or whats wrong, also i have the virtual host becouse if i dont do so, i cant access the xamp server at my private IP...

thanks for the help hope you know what i am talking about..

Re: typing the ip adress goes to xampp index!

PostPosted: 03. June 2009 18:37
by utan
So i fixed the problem when you typed the www. or the http://www it would go to the xampp directory intead of website2.com...
the problem was in the directive "ServerAlias", to get the site to work as www or http://www you must use the ServerAlias *.website2.com.

<VirtualHost *:80>
ServerAdmin website2@website2.com
DocumentRoot /opt/lampp/htdocs/website2
ServerName website2.com
ServerAlias *.website2.com
</VirtualHost>

that fixed the problem above, bu i couldnt fix that typing my ip it would bring you to the xampp page, i will try to fine a way to fix that myself, when i have it i'll post here.... thanks, for the record the virtual host configuration its at /opt/lampp/etc/extra/
thanks will return later with my finds

Re: typing the ip adress goes to xampp index!

PostPosted: 03. June 2009 22:45
by Sharley
You are missing a NameVirtualHost *:80 Directive entry before your first localhost container which makes your vhost configuration an IP-based vhost that is missing an IP for each vhost - so you are being served the default vhost which is the XAMPP index.php at localhost.
http://httpd.apache.org/docs/2.2/vhosts/

Also you don't need a ServerAlias for ServerName localhost:
ServerName localhost
ServerAlias localhost

Re: typing the ip adress goes to xampp index!

PostPosted: 04. June 2009 19:58
by utan
Hi thanks for your reply...

indeed i have setup NameVirtualHost *:80 before my <virtualhost>
so i dont really know what your talking about, still typing my ip goes to my xampp folder....
thanks again.

Re: typing the ip adress goes to xampp index!

PostPosted: 06. June 2009 18:10
by utan
So i have manage to hide the website, when someone type my IP addres, I have deleted the Index.php that redirect you to the xampp folder, so when someone type the ip it will just get white space, its a good workaround, I cant access the xampp index by private Ip in network and tweak from there... thanks for the help people... :D