So I followed this tutorial to set up my wordpress project on my local: http://jason.pureconcepts.net/2012/10/install-apache-php-mysql-mac-os-x/
However, it is giving me a
Forbidden You don't have permission to access / on this server.
error. I even tried changing the permissions of my project to 777
, but nothing works. I should have Apache, MySQL, and PHP all running now. This is my /etc/apache2/extra/httpd-vhosts.conf
file:
<VirtualHost *:80>
DocumentRoot "/Users/emai/Documents/wordpress_projects/ahrf"
ServerName ahrf.local
ErrorLog "/private/var/log/apache2/dummy-host2.example.com-error_log"
CustomLog "/private/var/log/apache2/dummy-host2.example.com-access_log" common
<Directory "/Users/emai/Documents/wordpress_projects/ahrf">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
And my /etc/hosts has this line 127.0.0.1 ahrf.local
added. So it looks like my apache config + hosts file are configured properly. I even tried adding the default _www
apache user to the staff
group on my mac.
Does anyone know how to fix this?
While Macs are immensely easy and dumbed down compared to Linux and Unix Apple has added a ton more overhead in terms of trying to configure one as a server like you would normally configure a Unix or Linux system. They’re running their own custom systems like Rendezvous, so there’s a little more to configure and troubleshoot. That being said, here are a few things:
ahrf.local
name. You would need to edit the hosts file of any systems trying to connect using that name. So on computer 2 you would edit the hosts file to seeahrf.local
as192.168.x.x
(with the proper ip address for the web server of course).755
. You should never allow777
because this allows “everybody” write access on the box. WordPress has a ton of holes which can be found online by searching “WordPress Hacked.”.local
domain..local
is reserved for Rendezvous. While it will share files with this naming convention it’s not really a published “domain name” and it will conflict with rendezvous if you’re trying to use it in DNS.If you want to run your Mac as a “production server” Apple has a “server” you can get “server” app from the app store that’s basically another GUI interface for all of the stuff that normally comes available to Unix and Linux as installation options. It’s cheap. This will allow you to run your own
DNS
server (and it’s a little easier interface than editing BIND).Also try pulling the directory declaration out of the VirtualHost. In all of the documentation examples they are separate.
Also remember after making changes to the
.conf
files you need to restart Apache. With.htaccess
you do not have to restart after each change.I know this is kind of old. But I followed same tutorial with my Mac machine to enable development with apache2 and faced the same situation.
To solve it I have added following line into my virtual host’s directory. After that when I accessed a directory, apache didn’t gave me a forbidden error.
After adding above line my virtual host configuration look like this.
Also please see the relevant section in apache documentation.
http://httpd.apache.org/docs/current/mod/core.html#options
Also enable the “Fancy directory listings” configuration file from your httpd.conf file.
Hope this helps.
Easiest Solution I found was to symlink.
By default DocumentRoot is in /Library/WebServer/Documents
cd /Library/WebServer/
sudo mv Documents Documents-old
sudo ln -s <sourcedir> ./Documents
Dont mess up with OSX Apache config and break your head. Not worth it!