virtualhost under xampp

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

virtualhost under xampp

Postby aadpouw » 28. September 2008 16:09

Hi all,

At present I follow the 'pastebin' project from the last zendframework dojo webinair.
To keep it short, they want me to setup a 'virtualhost'. That's where I spent time on this afternoon. In partial I succeeded, the server kept running. Only, I wasn't able to access my pages on the browser anymore.
This is what I've added to 'httpd-vhosts.conf'

<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/pastebin/public"
ServerName paste.local
ErrorLog log/apache2/paste.local-error_log
CustomLog log/apache2/paste.local-access_log common

<Directory /xampp/htdocs/pastebin/public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
At my first try I had in 'DocumentRoot' and 'Directory' this;'www/docs/pastebin/public' but with the same results, just an errorpage :(
Then my question; what is the best way the setup a virtualhost under xampp and preferrable without loosing access to the other files that I have in my 'htdocs'?

aadpouw
aadpouw
 
Posts: 8
Joined: 14. September 2008 08:29

Postby Wiedmann » 28. September 2008 16:35

just an errorpage

Nobody can know, which errorpage you have. (the exact message / error code)
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

tried a bit further

Postby aadpouw » 28. September 2008 20:19

At first an answer on your question; the error that I got was '404'.
But in the time between I've tried a bit further and this is where I ended.
- It's exactly as the example on 'http://github.com/weierophinney/pastebin/tree/master' but then 'xampp' added to the filepaths

<VirtualHost *:80>
DocumentRoot /xampp/var/www/pastebin/public
ServerName paste.local
ErrorLog /xampp/var/log/apache2/paste.local-error_log

CustomLog /xampp/var/log/apache2/paste.local-access_log common

<Directory /xampp/var/www/pastebin/public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

There is only one step that I don't know how to get done and that's this;

In this particular example, we use the ServerName "paste.local"; you
will need to add this to your hosts file:

127.0.1.1 paste.local

Where do I find that 'hosts' file?

Because sofar it's looking good, when I type 'http://paste.local/' it is changing it in 'http://www.paste.local/', only Firefox gives a message 'address not found' :(

Anyhow, thanks.

aadpouw
aadpouw
 
Posts: 8
Joined: 14. September 2008 08:29

End of trying.

Postby aadpouw » 29. September 2008 19:58

I've just got it all done, just with a bit of googling and persistence.
The result is that I have access to all my files in localhost and that I've access to 'paste.local'.

This is how I did it:
1. adding '127.0.1.1 paste.local' to my hostfile. Where to find that is depending on your system, you might have a look at
'http://rudyegenias.wordpress.com/2006/08/18/xampp-using-hosts-files-in-windows-to-map-your-local-server/', there you will find all the info about it.

2. added to my virtualhost file 'xampp/apache/conf/extra/httpd-vhosts.conf'.

#this you will need to keep access to your localhost
<VirtualHost *:80>
ServerName localhost
DocumentRoot "C:/xampp/htdocs"
</VirtualHost>

#this to get acces to paste.local
<VirtualHost *:80>
DocumentRoot var/www/pastebin/public
ServerName paste.local

#important, this you have to place in your apache directory
ErrorLog mylogs/apache2/paste.local-error_log
CustomLog mylogs/apache2/paste.local-access_log common

<Directory var/www/pastebin/public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

That's it :)
Now I can go on with my learning about zendframework + dojo :-)

aadpouw
aadpouw
 
Posts: 8
Joined: 14. September 2008 08:29


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 119 guests