How to Set Up Apache Virtual Hosts on Mac OS X Snow Leopard

follow url I have written before about Setting up multiple virtual hosts in WAMP on a PC but I need to to the same thing now for my iMac for local web development. I'll cover which files you need to change and where to find them.

مباشر السوق السعودية First up: httpd.conf
Where is httpd.conf? /private/etc/apache2/httpd.conf

http://www.dramauk.co.uk/?arapyza=%D8%A7%D8%B3%D8%AA%D8%B1%D8%A7%D8%AA%D9%8A%D8%AC%D9%8A%D8%A9-%D9%85%D8%AB%D8%A7%D9%84%D9%8A%D8%A9-%D8%A7%D9%84%D8%AE%D9%8A%D8%A7%D8%B1%D8%A7%D8%AA-%D8%A7%D9%84%D8%AB%D9%86%D8%A7%D8%A6%D9%8A%D8%A9&406=5a To edit the httpd.conf file, on a Mac I'm using VI via the terminal.

http://parts.powercut.co.uk/?risep=%D8%A7%D9%84%D9%81%D9%88%D8%B1%D9%83%D8%B3-%D8%A3%D8%AF%D9%85%D9%8A%D8%B1%D8%A7%D9%84&f6a=ba Simply open terminal and type:

follow url sudo vim /private/etc/apache2/httpd.conf

لنا منصات تداول الخيارات الثنائية Now find this line:

استثمار بالذهب NameVirtualHost 127.0.0.1 <VirtualHost 127.0.0.1> ServerName localhost DocumentRoot "/Library/WebServer/Documents" </VirtualHost>

follow link Add this underneath:

http://parts.powercut.co.uk/?risep=%D8%B7%D8%B1%D9%82-%D9%84%D8%B1%D8%A8%D8%AD-%D8%A7%D9%84%D9%85%D8%A7%D9%84-%D9%81%D9%8A-%D8%A7%D9%84%D8%AC%D8%A7%D9%85%D8%B9%D8%A9&4b1=f6 <VirtualHost 127.0.0.1> ServerName yourProject.local DocumentRoot "/Wherever/Your/Project/Exists" </VirtualHost>

go الخيارات الثنائية حر لا إيداع مكافأة 2017 Next (and last): Hosts (Official Apple Support document)
Where is the host file?

http://investingtips360.com/?klaystrofobiya=%D9%82%D9%86%D8%A7%D8%A9-%D8%A7%D9%84%D8%A7%D8%B3%D9%87%D9%85-%D8%A7%D9%84%D8%B3%D8%B9%D9%88%D8%AF%D9%8A%D9%87-%D9%85%D8%A8%D8%A7%D8%B4%D8%B1&5ec=be To edit the hosts file, simply open terminal again and type:

http://www.livingwithdragons.com/?printers=%D8%B7%D8%B1%D9%8A%D9%82%D8%A9-%D8%A8%D9%8A%D8%B9-%D8%A7%D9%84%D8%A7%D8%B3%D9%87%D9%85-%D9%81%D9%8A-%D8%A8%D9%86%D9%83-%D8%A7%D9%84%D8%A7%D9%87%D9%84%D9%8A&b1c=f1 sudo vi /private/etc/hosts

بيع الاسهم عن طريق النت You should see this line:

here 127.0.0.1 localhost

go to site Underneath that, add:

enter site 127.0.0.1 myProject.local (Use whatever extension you want (e.g., .local))

After making these changes, make sure to restart web sharing services. (System Preferences > Sharing > File Sharing : uncheck and then check the box to restart).

UPDATE 6/14/11: I'm going through this process again on my new MacBook Pro and I'm getting a "Forbidden You don't have permission to access / on this server." error. I remember running into this mess before setting up a coworkers machine so I'm going to document how I get myself out.

The first thing I noticed was in the httpd.conf file, the only directory allowed access was <Directory "/Library/WebServer/Documents">. By default, everything else is set to 'deny from all' which means no traffic is getting through. Here's what I added:

<Directory "/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

(I copied most of the directive body from the original one).

Warning: Don't f**k up the case and spacing (e.g., no space between 'allow,deny')

One last thing I had to do was change the DocumentRoot. It was defaulted to "Library/WebServer/Documents", so I changed it to:

DocumentRoot "/"

Those are all the changes I had to make to get "local.mywebsite.com" up and running.

  1. Pingback: Twitter Trackbacks for How to set up Apache virtual hosts on Mac OS X Snow Leopard [dennisplucinik.com] on Topsy.com

  2. Awesome post! It really helped me a lot! Thanks for sharing it.

  3. anon says:

    Thanks, worked perfect

  4. jonathan says:

    I’ve followed all these steps and it works perfect for simple web development, however, I’m mostly a WordPress based developer and Iv’ve found out that htaccess are not being loaded or executed when WP is installed, the default htaccess for WP, which takes care of nice permalinks, is properly installed in my vhost, but when I configure my permalinks, for example to /%year%/%monthnum%/%day%/%postname%/ The permalinks fire up a 404. Where do you think the error might be? I hope there is some way to solve it :)

  5. Michael says:

    What you’re doing here is quite dangerous.
    http://www.livingwithdragons.com/?printers=%D8%AA%D8%AF%D8%A7%D9%88%D9%84-%D8%AA%D8%AC%D8%B1%D9%8A%D8%A8%D9%8A-%D9%84%D9%84%D8%A7%D8%B3%D9%87%D9%85-%D8%A7%D9%84%D8%B3%D8%B9%D9%88%D8%AF%D9%8A%D8%A9&5b4=92 Never change the permissions on the root to allow all requests.
    Instead, leave this block untouched:

    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all

    and add this after the original … block:

    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all

    • Michael, is this what you are recommending?

      <Directory "/">
          Options FollowSymLinks
          AllowOverride None
          Order deny,allow
          Deny from all
      </Directory>
      
      <Directory "/">
          Options Indexes FollowSymLinks MultiViews
          AllowOverride All
          Order allow,deny
          Allow from all
      </Directory>
      

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>