Lost localhost

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

Lost localhost

Postby samsmom » 25. October 2009 05:03

After alot of trial and error, I finally got a virtual host working. NOW, I've lost localhost. This is not the first PC I've installed this on, but it is the first Vista.

Anytime I put localhost in first, I couldn't get Apache to restart. I currently have:

<VirtualHost *:80>
ServerName hmecsc
DocumentRoot "c:\\servers\hmecsc"
ServerAdmin webmaster@hmecsc
ErrorLog "C:\xampp\apache\logs\hmecsc.log"
<Directory "c:\servers\hmecsc">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

<VirtualHost *:80>
ServerName localhost
DocumentRoot "c:\\xampp\htdocs"
ServerAdmin webmaster@localhost
ErrorLog "C:\xampp\apache\logs\localhost.log"
<Directory "c:\xampp\htdocs">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>


The "hmecsc" site works great, but there's no localhost. I rarely use localhost, but I wouldn't like to have some idea why this keeps happening. I have this as my hosts:
127.0.0.1 localhost
127.0.0.1 cdtc (haven't configured yet)
127.0.0.1 hmecsc
#::1 localhost
samsmom
 
Posts: 2
Joined: 25. October 2009 03:31

Re: Lost localhost

Postby Izzy » 25. October 2009 06:21

Try the following by copy and paste into the apache\conf\extra\httpd-vhosts.conf file.
Code: Select all
NameVirtualHost *:80

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

<VirtualHost *:80>
ServerName hmecsc
DocumentRoot "C:/servers/hmecsc"
<Directory "C:/servers/hmecsc" >
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ServerAdmin webmaster@hmecsc
CustomLog logs/hmecsc_access.log combined
ErrorLog logs/hmecsc_error.log
</VirtualHost>
Save the file and then restart Apache.

samsmom wrote:Anytime I put localhost in first, I couldn't get Apache to restart.
When ever Apache can't start check out the error.log file for clues.

If there is a mistake in the vhosts file then Apache will resolve to the first good entry and is more than likely why you lost the localhost as it had errors and try using forward slashes first which is the server's default...

...but if you have issues with Vista some have found that using back slashes helped.

Localhost needs only limited entries as it is mainly covered in the httpd.conf file and so there is no need to duplicate the entries.

Logs for localhost are the access.log and the error.log files in the apache\logs folder so no need to duplicate and have too many log files to look through.

The other logs for vhosts are now defined better but you may change those if you prefer a shorter title and they don't need a full path unless they were placed elsewhere on your PC.

Your hosts file looks OK.

If the above code section works then you should be able to add your next vhost cdtc by using the hmecsc as a template.

Good luck.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Re: Lost localhost

Postby samsmom » 26. October 2009 17:36

Thanks for your help. It didn't solve my problem but I mentioned it to someone who said that the index.php was being called first in the http.config. I moved it to the end, and everything worked!
samsmom
 
Posts: 2
Joined: 25. October 2009 03:31

Re: Lost localhost

Postby Strider » 21. November 2009 17:47

just wanted to say thanks.
I have been running 2000 for years and when I switched to xp sp3 and vista the other day the virtual hosts wouldn't play.
I was swamped and couldn't get my virtual hosts running and with the tip you gave came right up
just an addition, and I am sure everyone already knows this, is to modify the hosts file with
127.0.0.1 servername
once again thanks
Strider
 
Posts: 1
Joined: 25. September 2005 02:39


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 186 guests