Search code examples
apachesymfonyvirtualboxhttp-status-code-403virtual-hosts

Access forbidden: You don't have permission to access the requested directory


I'm running an ubuntu server on oracle virtualbox from windows.

I have installed a symfony2 website(lets say that it's called pepper.com) on the server under var\www,

but no matter how I configure my xampp\apache\conf\extra\httpd-vhosts.conf file, I always get Access forbidden, Error 403 when I'm trying to access www.pepper.com on the browser.

I've been searching for quite some time but I couldn't resolve this problem.

My httpd.conf file:

    ...
    ...
    Listen 127.0.0.1:80
    ...
    # Virtual hosts
    Include conf/extra/httpd-vhosts.conf

My httpd-vhosts.conf:

    NameVirtualHost *:80

    <VirtualHost *:80>
         ServerAdmin stefanos@myserver.pepper.com
         DocumentRoot "var/www/pepper.com/web"
         ServerName www.pepper.com
         ServerAlias www.myserver.pepper.com
        <Directory var/www/>
             Require all granted
        </Directory>
    </VirtualHost>

My hosts file:

    127.0.0.1       www.pepper.com

Solution

  • Your var/www/ should be /var/www/ otherwise it will take var/www relatively from the directory that Apache runs out of.