Reputation: 27527
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?
Upvotes: 2
Views: 7794
Reputation: 1396
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!
Upvotes: 0
Reputation: 5181
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.
Options Indexes FollowSymLinks MultiViews
After adding above line my virtual host configuration look like this.
<Directory "/Users/uiroshan/development/php">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Also please see the relevant section in apache documentation. http://httpd.apache.org/docs/current/mod/core.html#options
Indexes If a URL which maps to a directory is requested, and there is no DirectoryIndex (e.g., index.html) in that directory, then mod_autoindex will return a formatted listing of the directory.
Also enable the "Fancy directory listings" configuration file from your httpd.conf file.
Include /private/etc/apache2/extra/httpd-autoindex.conf
Hope this helps.
Upvotes: 2
Reputation: 7880
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 see ahrf.local
as 192.168.x.x
(with the proper ip address for the web server of course).755
. You should never allow 777
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.
<Directory "/Users/emai/Documents/wordpress_projects/ahrf">
Options -FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<VirtualHost *:80>
DocumentRoot "/Users/emai/Documents/wordpress_projects/ahrf"
ServerName ahrf.home
ErrorLog "/private/var/log/apache2/dummy-host2.example.com-error_log"
CustomLog "/private/var/log/apache2/dummy-host2.example.com-access_log" common
</VirtualHost>
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.
Upvotes: 2