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


Postby wraithstk » 19. March 2010 18:42

How can you set up XAMPP so that a certain port sends you to a certain directory or file?
Posts: 3
Joined: 18. March 2010 16:19

Re: Ports

Postby MegaChriz » 22. March 2010 16:16

You will need to set up virtual hosts.

1. Open "Applications/XAMPP/xamppfiles/etc/httpd.conf" and uncomment the following line:
Code: Select all
Include /Applications/XAMPP/etc/extra/httpd-vhosts.conf

2. In the same file, add the line
Code: Select all
AcceptMutex Flock
above the line you just uncommented. The 'AcceptMutex Flock'-line need to be added because of a bug in XAMPP that caused that using multiple ports was not working.

3. Open "Applications/XAMPP/xamppfiles/etc/extra/httpd-vhosts.conf", there you can specify your virtual hosts.
For example, if you want that port 1000 directs you to the directory '/Applications/XAMPP/xamppfiles/htdocs/mywebsite/', replace the contents of the file with this:
Code: Select all
Listen 1000
NameVirtualHost *:1000
<VirtualHost *:1000 >
    DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/mywebsite"

4. Restart Apache or XAMPP to get your virtual host working.

A server error may occur if you have .htaccess-file inside the 'mywebsite'-directory, if that's the case add the following as well to the 'httpd-vhosts.conf'-file:
Code: Select all
<Directory "/Applications/XAMPP/xamppfiles/htdocs/mywebsite">
   Options Indexes FollowSymLinks ExecCGI Includes
   AllowOverride All
   Order allow,deny
   Allow from all

There are more possible variables for VirtualHost you can set. In the example I had only specified DocumentRoot. For example, you can also set 'ServerAdmin' (e-mailaddress) and 'ErrorLog' (filepath of where servererrors should be stored). You will see some of the possible variables when you first open the 'httpd-vhosts.conf'-file.
Posts: 158
Joined: 16. February 2009 15:04
Location: Amersfoort, The Netherlands
Operating System: Mac OS X

Return to XAMPP for Mac OS X

Who is online

Users browsing this forum: No registered users and 4 guests