Enable Virtual host on XAMPP for OSX

By , April 26, 2014 10:42 pm

I just upgraded XAMPP to the latests version and in doing so I was no longer able to access my files stored in my Users/user/Sites folder. By default XAMPP does’t come setup for allowing virtual hosting. You have to setup it up yourself. This is the process to setup Virtual Hosting on OSX 10.8.3.

  1. Open Terminal. It is located in your Applications/Utilities folder
  2. Type in the following command.

    sudo pico /Applications/XAMPP/xamppfiles/etc/httpd.conf

  3. Press Control key and V to scroll down to the bottom of the file. Keep doing it until you find the following lines.

    # User home directories
    #Include etc/extra/httpd-userdir.conf

  4. Uncomment out Include ext/extra/httpd-userdir.conf by deleting the # sign. It should look like this when you are done.

    # User home directories
    Include etc/extra/httpd-userdir.conf

  5. Save the changes. Press the Control Key and O. The click the Control Key and T.
  6. Select the httpd.conf file name and hit the Enter Key. This will over write the httpd.conf with the changes you just made.
  7. Press the Control Key and X to exit the editor.
  8. Next type in the following command in to Terminal to edit the httpd-userdir.conf file.

    sudo pico /Applications/XAMPP/xamppfiles/etc/extra/httpd-userdir.conf

  9. Find the follow line and comment it out.

    UserDir public_html

  10. It should look like this after you comment it out: #UserDir public_html
  11. Type in the following line: UserDir Sites
  12. Find the following lines and comment them out.

    <Directory “/home/*/public_html”>

  13. Add the following line: <Directory “/Users/*/Sites/”> right after the line you just commented out.
  14. Save the changes. Press the Control Key and O. The click the Control Key and T.
  15. Select the httpd-userdir.conf file name and hit the Enter Key. This will over write the https.conf with the changes you just made.
  16. Press the Control Key and X to exit the editor.
  17. Restart the Apache Server.

Leave a Reply

Panorama Theme by Themocracy