简体   繁体   中英

localhost now 403 Forbidden OS X Apache

http://mallinson.ca/post/osx-web-development/

I was following the above guide for setting up the OS X Mavericks local development environment on my new mac and originally everything worked out. Not really sure what happened afterwards, but after leaving my computer for sometime, working on other stuff, and maybe rebooting, I now get a Forbidden -- You don't have permission to access / on this server. (403 Forbidden in title bar) when I try to go to ANYTHING.dev, localhost, 127.0.0.1, etc. Since I didn't change any of the files mentioned in the article since it was last working, my guess is this is some sort of permissions issue .

The only file from this entire setup that is different than what is in the guide is httpd-vhosts.conf found in /private/etc/apache2/extra/, which was simply changed to match my directories rather than the author's. Just in case, you can view the file here -- http://pastebin.com/wcr1fdZe (I have 2 hard drives, SSD boot and HDD for storage and named storage, so I found it reasonable to put the www directory on the HDD)

By the way, that directory is as follows /Volumes/Storage/www/sites/home/wwwroot where sites is the only folder in www and home is the only folder in sites and wwwroot is empty.

Can someone please help me fix this?

Note: I actually also tried going through this guide earlier and it worked originally and then it failed randomly with the same 403, so I reinstalled OS to see and it worked and failed again in a similar manner. I have tried flushing dns cache and restarting apache server via terminal. I'm new to this stuff so please provide specific commands, paths, etc. when something needs to be done, and ask if you need more details.

> UPDATE: so @matanco has got this figured out for me if you look below, but there's still ONE problem... localhost is working, BUT home.dev, me.dev, anything.dev,etc. still has 403

just follow those steps this is simple permission issue:

cd /usr/local/apache2/htdocs/ (if you changed it navigate to your folder)

chmod 644 .

chmod +x .

hope that will solve your problem.

EDIT::

add this to your httpd-vhosts.conf

<VirtualHost *:80>     
ServerName localhost    
DocumentRoot /Library/WebServer/Documents/
 </VirtualHost>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM