Page 2 of 3

Re: keeping multiple sites in htdocs

PostPosted: 15. January 2011 04:33
by gwmbox
Sharley wrote:GW, I don't see this at the start of your vhosts, did you forget to add it?
Code: Select all
NameVirtualHost *:80


Wow, thanks for such a quick reply :)

Yes that was it, I forgot to uncomment it :)

All working and again thanks for the help.

Cheers

GW

Re: keeping multiple sites in htdocs

PostPosted: 15. January 2011 04:38
by Sharley
Your welcome and pleased that you can now move forward. :)

Good luck and best wishes.

Re: keeping multiple sites in htdocs

PostPosted: 21. February 2011 22:17
by northerntony
Hi Sharley,

I tried following your instructions as they are above, but Apache wouldn't start - it kept going off after a second or 2. I checked the error log and noticed the following message:
(OS 3)The system cannot find the path specified. : httpd.exe: could not open error log file C:/xampp/apache/domlogs/test_error.log.
Unable to open logs.


I then deleted the folowing two lines from the httpd-vhosts.conf file and it worked fine.

Code: Select all
CustomLog domlogs/mylocalchurch_access.log combined
ErrorLog domlogs/mylocalchurch_error.log


Do you know why this didn't work, did I miss something? And what are the implications of not having the seperate error logs?


Sorry if this is a silly question but I'm completely new to all this. I must say thanks for the help given above, it was easy to follow and I apreciate the time you've taken to help us all.

Tony

Re: keeping multiple sites in htdocs

PostPosted: 24. February 2011 22:56
by Sharley
If you want separate log files for each of your vhosts, which is recommended to make life easier for finding issues with individual vhosts instead of them all being lumped together in the single error.log file in the apache\logs folder, then you need to create the folder \xampp\apache\domlogs or any suitable folder name of your choice and give your log files names of your choosing.

Apache will create the named log files in the named folder you create when apache starts and reads the httpd-vhosts.conf file.

The lines you quoted and deleted were an example for the OP and would give an error unless the folder domlogs was created in the apache folder.

Re: keeping multiple sites in htdocs

PostPosted: 10. October 2011 08:20
by JRTphotog
Hi and thank you for your help.

win7 64
using xampp 1.7.7

With the below I am still getting the xampp homepage(local) when typing in 40somethingcowgirls.loc
I have restarted apache, cleared cache, restarted comp ect....ideas?

hosts.txt
Code: Select all
127.0.0.1       localhost
127.0.0.1 40somethingcowgirls.loc
127.0.0.1 truevisionvirtualtours.loc
::1             localhost


httpd-vhosts.conf
Code: Select all
NameVirtualHost *:80

<VirtualHost *:80>
ServerName localhost
DocumentRoot "C:/TestingServer/htdocs"
<Directory "C:/TestingServer/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride AuthConfig
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

<VirtualHost *:80>
ServerName 40somethingcowgirls.loc
ServerAlias www.40somethingcowgirls.loc
DocumentRoot "C:/TestingServer/htdocs/40sc-2.0-live"
<Directory "C:/TestingServer/htdocs/40sc-2.0-live">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride AuthConfig
Order allow,deny
Allow from all
</Directory>
</VirtualHost>


thank you again

Re: keeping multiple sites in htdocs

PostPosted: 10. October 2011 08:33
by Sharley
Try this
Code: Select all
NameVirtualHost *:80

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

<VirtualHost *:80>
ServerName 40somethingcowgirls.loc
ServerAlias www.40somethingcowgirls.loc
DocumentRoot "C:/TestingServer/htdocs/40sc-2.0-live"
<Directory "C:/TestingServer/htdocs/40sc-2.0-live" >
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
First you don't need to specify a Directory for ServerName localhost as that is taken care of in the httpd.conf file.

Second unless your site is set up to have a user/pass then AllowOverride should be set to All as Apache is looking for the .htaccess/.htpasswd combination so it can authenticate the site.

Let me know back please if that helps, also remember to restart Apache and clear your browser's cache.

Good luck :)

Re: keeping multiple sites in htdocs

PostPosted: 10. October 2011 10:22
by JRTphotog
firstly, thanks for your quick reply. The service you provide is appreciated.

I made the changes and still getting the xampp page. I cant figure this out. This is a fresh install.

no need for user/pass on this site, just a production/testing server.

Re: keeping multiple sites in htdocs

PostPosted: 10. October 2011 10:35
by Sharley
There is an issue somewhere because your vhosts is defaulting to the localhost, which is the indicator.

Use the new xampp-control-3-beta.exe in the xampp folder but first stop Apache and MySQL using the old version 2.5 control panel and Exit it.

Then Start Apache and MySQL using V3 CP it has more features.

Next click on the xammp-shell button and type at the # prompt exactly this:
httpd.exe -S

Then using the little icon top left of the console window select Edit then mark and copy the contents and then in a reply box paste the content between code tags.

This will hopefully give us a clue.

Good luck. :)

Re: keeping multiple sites in htdocs

PostPosted: 10. October 2011 10:51
by JRTphotog
Thank you

Code: Select all
Setting environment for using XAMPP for Windows.

John@HYBRID7 c:\testingserver\xampp
# httpd.exe -S
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
_default_:443          localhost (C:/TestingServer/xampp/apache/conf/extra/httpd
-ssl.conf:80)
Syntax OK

John@HYBRID7 c:\testingserver\xampp

Re: keeping multiple sites in htdocs

PostPosted: 10. October 2011 11:25
by Sharley
Your very welcome. 8)

I see this possible issue:.
Code: Select all
DocumentRoot "C:/TestingServer/htdocs/40sc-2.0-live"
<Directory "C:/TestingServer/htdocs/40sc-2.0-live" >
This should be "C:/TestingServer/xampp/htdocs/40sc-2.0-live"

See if changing the paths helps including the one in localhost.

Good luck. :)

Re: keeping multiple sites in htdocs

PostPosted: 10. October 2011 12:04
by JRTphotog
same result

same output from xampp shell as well.

blah :(
4 am here, need sleep :cry: , I will check your suggestions in a few hours.

thank you for racking your brain on this one. this is a case of "dont fix it if it aint broke". I uninstalled my previous version because it would prevent photoshop from opening when xampp was running. I saw a new version and thought "this should only cost me an hour or so", that was 2 days ago....

:x

Re: keeping multiple sites in htdocs

PostPosted: 10. October 2011 12:25
by Sharley
Very strange indeed because I replicated your configurations exactly and after changing the path it worked as expected. :shock:

:idea: Did you restart Apache after editing the httpd-vhosts.conf file?

Sleep well. :)

Re: keeping multiple sites in htdocs

PostPosted: 10. October 2011 21:13
by JRTphotog
After a few hours sleep I decided to uninstall xampp completely and reinstall using the default c:/xampp directory structure. I am happy to report that all is working with the vhost redirects.

I do have a two couple additional questions.
1) In my site root/include I have a mysql.php. The prior xampp install had site root folders in the xampp htdocs folder. This new install has the site roots on another drive.
Code: Select all
<VirtualHost *:80>
ServerName 40somethingcowgirls.loc
ServerAlias www.40somethingcowgirls.loc
DocumentRoot "F:/^--WEB/^--Sites/40SomethingCowgirls/40sc-2.0-live"
<Directory "F:/^--WEB/^--Sites/40SomethingCowgirls/40sc-2.0-live" >
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

with the following declared in mysql.php from the previous install
Code: Select all
define('DB_SERVER', 'localhost');
define('DB_USER', 'xxxxx');
define('DB_PASS', xxxxx'');
define('DB_NAME', 'something40cowgirls');
define('URL', 'http://localhost/40sc-2.0-live/');
define('MEMBERS_PATH', 'members/');
define('LOGOUT_URL', 'index.php');

how should the above paths read now that my site root is outside of the xampp folder?

2) One of my other sites uses Joomla!. This site(abcCorp) root is on the same drive as the previous site, "F:/^--WEB/^--Sites/abcCorp". Do I install Joomla into the abcCorp folder or into the xampp/htdocs folder?

Thank you again for your help. It has been refreshing to find someone interesting in helping others solve issues instead of the more common flamings issued by trollers nowadays.
good karma to you :D

Re: keeping multiple sites in htdocs

PostPosted: 10. October 2011 22:10
by Sharley
1. use the full path enclosed in quotation marks " " as usual in the vhosts files, except in the mysql.php file, which looks fine. ;)

Always backup files and folders before editing. 8)

2. The choice is yours but if installed outside the htdocs folder you will need to create another vhost section for abcCorp.

Tip. :idea:
Most things in XAMPP are case sensitive (unlike Windows) so try and keep everything lowercase including file and folder names unless absolutely essential - saves confusion and possible 404 errors.

Good luck, :)

Re: keeping multiple sites in htdocs

PostPosted: 10. October 2011 22:30
by JRTphotog
your awesome, thanks for the reply on the mysql issue, i will let you know how that goes