localhost wont work with virtual host

Problems with the Mac OS X version of XAMPP, questions, comments, and anything related.

localhost wont work with virtual host

Postby daman » 22. June 2010 16:59

Like many, my goal is to create a web dev environment as I learn before posting up on a hosted server. I keep my computer partitioned with the root partition housing the OS of course and the final partition containing all my user content which includes my sites. I also keep another partition with a fresh unharmed install of OS X. My complication lies where I try to set up a virtual host. Skipping the details of my two weeks of fails and successes, here is a snapshot of my current situation…

Using XAMPP, for whatever reason my relative links were not working properly. When i came across some clue that suggests i should us a virtual host to get the relative links working i then followed another tutorial on this subject. I was successful in getting XAMPP to work with a virtual host but then "localhost" reports back as "404 page not found". Using XAMPP i need to access the MySQL folder where my databases live. Without using a virtual host i have been successful in housing my site in my user sites folder and accessing the XAMPP admin page along with the PHPmyAdmin.

I'm in "process of elimination" mode as i try to troubleshoot my way to some resolve. I killed XAMPP and followed another tutorial in setting up Apache/php/MySQL then repeated the process for setting up the virtual host and ended up with the same results… "404 not found". I was under the belief that i could have unknowingly messed up some configuration in XAMPP so by trying the native OS Apache install at least it gives some hope that i didn't mess up XAMPP.
I then assumed i might have messed up some configuration within the OS… I then booted into my fresh install of OS X and repeated the above. Again, success using Apache but no luck when trying to access localhost. Same results! So, I think it's safe to say that my OS config is fine, XAMPP config is fine… which brings me to the common place of the httpd.conf or the vhosts.conf files. Seeing as I can revert back at any time to dropping the virtual hosts and using only the httpd.conf file with success, this leads me to believe that I don't have the write tags in my vhosts file. Now I have tried more numerous configurations than there are neurological pathways in my head, so here's the latest...

#### LOCALHOST - DO NOT CHANGE ####
#
VirtualHost *:80>
ServerName localhost
DocumentRoot “/Applications/XAMPP/xamppfiles/htdocs”
Directory “/Applications/XAMPP/xamppfiles/htdocs”>
Options Indexes FollowSymLinks Includes execCGI
AllowOverride None
Order Allow,Deny
Allow From All
/Directory>
/VirtualHost>

#### VIRTUAL HOST - MySite ####
#
VirtualHost *:80>
ServerAdmin removed4post@gmail.com
DocumentRoot "/Volumes/UserData/Sites/MySite"
ServerName svr.loc
ErrorLog "logs/svr.loc-error_log"
CustomLog "logs/svr.loc-access_log" common
/VirtualHost>

Now, i wouldn't mind working in the native set up using OS X's Apache install, but i run into the complication of using php 5.3.1 which has reported bugs that prevent me from using mediawiki. I stepped down to XAMPP version 1.7.2 for this reason after having tried countless attempts to up/downgrad php and failed. My goal was to learn web dev not web hosting and have yet to be able to really get started. Please help : )
daman
 
Posts: 1
Joined: 22. June 2010 08:08

Re: localhost wont work with virtual host

Postby MegaChriz » 23. June 2010 08:16

You could better not use XAMPP v1.7.2, since it had some problems. And XAMPP v1.7.2 came with PHP 5.3. I don't know the differences between PHP 5.3.0 and PHP 5.3.1. Are the bugs which prevent you from using MediaWiki introduced in PHP 5.3.1? If those bugs are also present in PHP 5.3.0, you could consider to downgrade to XAMPP v1.0.1, which came with PHP 5.2.9.

I can't help you much with the virtual hosts. I make use of virtual hosts, but in my situation the sites are on the same volume as XAMPP is (the startup-volume).
I've no experience with namebased virtual hosts, I've been using ports so far. I don't think using ports will make a difference, but you could give it a try. There is only one bug in XAMPP with using multiple ports, but that bug can be avoided with writing down the line 'AcceptMutex Flock' in your httpd.conf.
MegaChriz
 
Posts: 158
Joined: 16. February 2009 15:04
Location: Amersfoort, The Netherlands
Operating System: Mac OS X

Re: localhost wont work with virtual host

Postby jmdirc » 24. June 2010 22:23

Did you remove all the open tags for a reason? Try a forward slash after htdocs. And try <virtualhost localhost:80> as an opening tag.

example:
Code: Select all
<VirtualHost localhost:80>
ServerName localhost
DocumentRoot “/Applications/XAMPP/xamppfiles/htdocs/”
</VirtualHost>

<Directory “/Applications/XAMPP/xamppfiles/htdocs/”>
Options Indexes FollowSymLinks Includes execCGI
AllowOverride None
Order Allow,Deny
Allow From All
</Directory>
An artist/designer/ and now programer exploring the creative sides.
User avatar
jmdirc
 
Posts: 154
Joined: 10. February 2008 22:44


Return to XAMPP for macOS

Who is online

Users browsing this forum: No registered users and 21 guests