localhost not working anymore - but virtual hosts is working

Problems with the Windows version of XAMPP, questions, comments, and anything related.

localhost not working anymore - but virtual hosts is working

Postby mikenovember » 08. November 2006 00:30

Thanks for helping me setting up my virtual hosts - it is working fine now.

But just one more thing...

For some reason when I type "localhost" in my web-browser - it is not asking me for any password and I can therfore not accessing my XAMPP dashboard - instead it goes to the first virtual-host that I setup up in my virtual-host.conf file - in this case lc.example.com

If I delete the:

Include virtual-host.conf in the main apache conf file - localhost is working again, but obviously I lost my virtual host again.

Thus I assume it is something wrong with my virtual-host.conf file:

Can anybody please check the attached virtual-host.conf code underneath and advise me of any changes to me so that I can still run localhost and the virtualhosts:

The code:

# Use name-based virtual hosting.
NameVirtualHost *:80

# Virtual host setup for www.example.com

<VirtualHost *:80>

ServerName lc.example.com
DocumentRoot "G:/xxxxxx/Customers/CustomerExample/example.com/site/web"

CustomLog logs/lc.example.com.access.log combined
ErrorLog logs/lc.example.com.error.log

<Directory "G:/xxxxxx/Customers/CustomerExample/example.com/site/web">
Options Indexes FollowSymLinks
AllowOverride FileInfo
Order allow,deny
Allow from all
</Directory>

</VirtualHost>


Thank you very much - In Advance!


[/b]
Mike November
Rookie Web Designer
Always need some help ... Please give me some advise!
mikenovember
 
Posts: 6
Joined: 07. November 2006 00:25
Location: London

Postby Wiedmann » 08. November 2006 01:02

For some reason when I type "localhost" in my web-browser - ... - instead it goes to the first virtual-host that I setup up in my virtual-host.conf file

That's the normal behaviour with namebased vhosts. Your first vhost is now your default server (as you can read in the Apache manual).
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby Izzy » 08. November 2006 03:19

Try this but change this "C:/xampp/htdocs" to your own path:

Code: Select all
# Use name-based virtual hosting.

# Virtual host setup for www.example.com

<VirtualHost 127.0.0.1:80>
ServerName localhost
DocumentRoot "C:/xampp/htdocs"
</VirtualHost>

NameVirtualHost *:80

<VirtualHost *:80>
ServerName lc.example.com
DocumentRoot "G:/xxxxxx/Customers/CustomerExample/example.com/site/web"
<Directory "G:/xxxxxx/Customers/CustomerExample/example.com/site/web">
Options Indexes FollowSymLinks
AllowOverride FileInfo
Order allow,deny
Allow from all
</Directory>
CustomLog logs/lc.example.com.access.log combined
ErrorLog logs/lc.example.com.error.log
</VirtualHost>
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Still problems

Postby mikenovember » 08. November 2006 21:07

Thanks for the help Izzy,

I have updated with the code you supplied.

The localhost is now working (asking me for my password and the lot), but when I am typing in for e.g. lc.example.com it stays at the XAMPP dashboard and do not run the index.html in lc.example.com.

Is there a futher change required.

Thanks,
Mike November
Rookie Web Designer
Always need some help ... Please give me some advise!
mikenovember
 
Posts: 6
Joined: 07. November 2006 00:25
Location: London

Just one more thing...

Postby mikenovember » 08. November 2006 21:22

I see that if I type lc.example.com in the browser and press enter,

it changes the url to

http://lc.example.com/xampp

I think the main config-file make it look for the example.com index.html file in the xampp file structure.

I thought mentioning this could help you guys to trace the problem

Thanks
Mike November
Rookie Web Designer
Always need some help ... Please give me some advise!
mikenovember
 
Posts: 6
Joined: 07. November 2006 00:25
Location: London

SOLVE IT!!!

Postby mikenovember » 08. November 2006 22:13

Thanks Guys - I finally put the last puzzle into place after playing around with the code.

To make it work - I just replace the 27.0.0.1 with a "*", and now localhost and virtual hosts is all working!!

If I type localhost + Enter in browser
then ask for user + password and goes to XAMPP dashboard

If I type lc.example.com + Enter in browser
then directly running the lc.example.com website

I am now satisfied with the result ... But if you guys still want to share some expert knowledge .......

What must I do to secure my virtual host sites with username and passwords ...... Is it possible?

Thanks
Mike November
Rookie Web Designer
Always need some help ... Please give me some advise!
mikenovember
 
Posts: 6
Joined: 07. November 2006 00:25
Location: London

Re: SOLVE IT!!!

Postby Izzy » 08. November 2006 23:23

mikenovember wrote:...What must I do to secure my virtual host sites with username and passwords ...... Is it possible?...

Yes it's possible. XAMPP uses user/pass to protect it's pages which can be access from the Security menu item in the Welcome page.

It uses the .htaccess/.htpasswd combination of files.

http://httpd.apache.org/docs/2.2/howto/auth.html

http://yolinux.com/TUTORIALS/LinuxTutor ... ction.html

http://www.widexl.com/scripts/documenta ... ccess.html

http://tools.dynamicdrive.com/password/

http://www.webmaster-toolkit.com/htacce ... ator.shtml

http://www.google.com/search?q=htaccess ... generators
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby WorldDrknss » 13. November 2006 20:43

Members and guest visitors to these forums should exercise extreme caution when using unofficial third party XAMPP help sites. You should use the XAMPP help files and facilities available from the official ApacheFriends web site, XAMPP Tutorials and from within the various configuration files in the form of item comments.
http://wdguides.org - XAMPP Tutorials & MORE!!!!
User avatar
WorldDrknss
 
Posts: 292
Joined: 17. September 2005 13:40


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 64 guests