SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Oct 2009
    Location
    London, UK
    Posts
    382
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Question Apache Virtual Hosts on mac os x 10.9

    Hi there,

    So I'm just setting up my new MacBook with a LAMP stack. I've set my home directory to ~/Sites.

    Now I want to set up virtual hosts so I can point urls to different document roots.

    So lets say I have a folder in my Sites directory named MySite.
    In /etc/hosts I add the following line:
    Code:
    127.0.0.1    mysite.dev
    Then in /etc/apache2/extra/httpd-vhosts.conf, I add:
    Code:
    <VirtualHost *:80>
    ServerName mysite.dev
    DocumentRoot /Users/username/Sites/MySite
    </VirtualHost>
    And hey presto, when I navigate to http://mysite.dev, I get the folder contents of ~/Sites.

    Not sure what I've done wrong... I've restarted apache, so its not that. Any ideas?

    Many thanks,
    M

  2. #2
    SitePoint Addict
    Join Date
    Oct 2009
    Location
    London, UK
    Posts
    382
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    OK, so I just thought I'd update the post with the solution in case anyone else has the same problem.

    In the httpd.conf file (/etc/apache2/httpd.conf) uncomment the line:
    Code:
    # Virtual hosts
    Include /private/etc/apache2/extra/httpd-vhosts.conf
    It's right near the bottom.

    BOOM!

  3. #3
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,299
    Mentioned
    460 Post(s)
    Tagged
    8 Thread(s)
    Thanks for posting the solution. I was following this thread, but couldn't find a solution myself.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •