WordPress Noob: Forbidden You don’t have permission to access / on this server. (using Mac)

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

Read More

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?

Related posts

Leave a Reply

3 comments

  1. 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:

    1. You should be able to connect to the system with the IP address and see the website. If you’re not running a DNS server then the system will not publish the 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).
    2. If you install BIND you will need to make all of the other local machines check the DNS server first to see if the system exists.
    3. Change permissions recursively in the folder to 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.”
    4. On Macs there’s an issue with using the .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.
    5. Make sure (if you have firewall enabled under security) in the firewall you’re allowing connections over port 80.
    6. There is a web sharing option under newer versions of Mac OS. In my experience a lot of the systems that are in place in the GUI actually overwrite some of the command line additions. You’ll need to either use the GUI exclusively or use the command line exclusively and then try to hunt down any issues in the GUI preventing the system from loading the page.
    7. You don’t need to run Apache as any other names or in any other groups other than the default as it only requires read and execute access to show the contents. The folders and files should have the permissions set for the user you’re using to create the files. You don’t want to make Apache own the files or you’ll run into problems updating the system. Any folders where a user might upload a file like an image will need other permissions, but the main folder does not. WordPress configures these settings on install.

    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.

  2. 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.

  3. 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!