2

I know it is a common problem, and it is mainly a matter of permissions to the user www-data, but following this guide I got the classic error:

403 forbidden 
You don't have permission to access /web on this server.

I was not able to find a solution online, despite the huge amount of people facing the same issue. Sorry! :)

This is my 000-default.conf file

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    DocumentRoot /home/tom/Dropbox/web
    <Directory />
            Options FollowSymLinks
            AllowOverride All
    </Directory>
    <Directory /home/tom/Dropbox/web>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
            AllowOverride All
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
    </Directory>

    ErrorLog /home/tom/Dropbox/web/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog home/tom/Dropbox/web/access.log combined

 Alias /doc/ "/usr/share/doc/"
 <Directory "/usr/share/doc/">
     Options Indexes MultiViews FollowSymLinks
     AllowOverride All
     Order deny,allow
     Deny from all
     Allow from 127.0.0.0/255.0.0.0 ::1/128
 </Directory>

and of course, the folder in which I tried to configure my local website is in ~/Dropbox/web.

Finally, these are the current permissions

drwxrwxrwx   8 tom tom   4096 mars  26 09:57 Dropbox
drwxrwxrwx   3 tom tom   4096 mars  26 11:47 web

Thanks

1 Answer 1

8

This happens after you upgrade to apache 2.4.9+

basically just replace

Order allow,deny
allow from all

with

Require all granted

should fix this issue.

something like,

<Directory /home/tom/Dropbox/web>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Require all granted
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
    AllowOverride All
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Require all granted
</Directory>

Here is a note from http://httpd.apache.org/docs/2.4/howto/access.html

If you wish to restrict access to portions of your site based on the host address of your visitors, this is most easily done using mod_authz_host.

The Require provides a variety of different ways to allow or deny access to resources. In conjunction with the RequireAll, RequireAny, and RequireNone directives, these requirements may be combined in arbitrarily complex ways, to enforce whatever your access policy happens to be.

The Allow, Deny, and Order directives, provided by mod_access_compat, are deprecated and will go away in a future version. You should avoid using them, and avoid outdated tutorials recommending their use.

2
  • @Sfrow did "Require all granted" solve the issue? Mar 26, 2015 at 21:12
  • 7 StackOverflow question in. This was the easiest and best to implement! Mar 21, 2017 at 21:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.