Search code examples
phpapache2localhostosx-elcapitan

Forbidden 403: Able to access localhost but unable to access folders within


I am able to access localhost and a folder inside it (http://localhost/ariaconfig/) but am unable to go further.

I am trying to access /Library/WebServer/Documents/ariaconfig/rest I have given access permission of read and write and also made the folder shared (using mac).

In my httpd.conf : have altered these lines but of no use.

DocumentRoot "/Library/WebServer/Documents"
<Directory "/Library/WebServer/Documents">
    Options Indexes FollowSymLinks Includes ExecCGI
    MultiviewsMatch Any
    Order deny,allow
    AllowOverride All
    Require all granted
</Directory>

In my httpd-vhosts.conf have added:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /Library/WebServer/Documents
    ServerName localhost
    ErrorLog "/private/var/log/apache2/localhost-error_log"   
    CustomLog "/private/var/log/apache2/localhost-access_log" common
</VirtualHost>

In error_log getting error as:

Cannot serve directory /Library/Webserver/Documents/ariaconfig/rest/: No matching DirectoryIndex (index.html,index.html,index.php,index.html,index.php) found, and server-generated directory index forbidden by Options directive

Thanks.


Solution

  • I think there is a spelling mistake in your httpd-vhosts.conf

    DocumentRoot /Library/WebServer/Documents

    this should be Webserver instead of WebServer S should be small as per your rules

    If thats not the case , please check index.html or index.php persist in your Document Root , If not please create it with some dummy html file . That would be the starting point for any web browser .

    Check out this wiki article on webserver directory index