12

I have noticed that I have the following lines in apache2.conf (on ubuntu 14.04):

<Directory /usr/share>
        AllowOverride None
        Require all granted
</Directory>

And the reason for this is written as:

not allow access to the root filesystem outside of /usr/share and /var/www. The former is used by web applications packaged in Debian, the latter may be used for local directories served by the web server.

But this tells me absolutely nothing. Can someone explain in a plain English why do I need to grant access to this folder.

3 Answers 3

8

if you are not using web applications which are packaged with your OS (or you install to that location) you can safely ignore it.

Examples of stuff which might be there though would include common PHP libraries (like ADODB etc), frameworks like Zend, programs like Cacti, Nagios, Cups etc may all be there.

There is, of-course, no harm in commenting this code out if you don't think your application uses it, and add it back if you get errors in your log of the nature that it can't read files there.

2

/usr/share is, as the quoted passage says, "used by web applications packaged in Debian."

If you install, say, Wordpress from an apt repository, it will be installed into /usr/share.

If that's still not plain English enough, we'll need more detail about what part of it you're understanding and what part of it you're not.

1
  • I do not understand whether I need to grant permissions for this folder if I am rolling out my own project. The only thing I have installed from apt (related to this project) is the mongo database. Sep 10, 2014 at 6:46
1

Additional information to the answer of davidgo:

You might want to grant access only from your local server, so configure it like the following:

<Directory "/usr/share/doc/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
    Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
2
  • I realize this info is from 5+ years ago; it doesn't work on apache2 out of the box on Ubuntu Studio 21.04. In particular, we're looking at: - SOFTWARE - * Ubuntu Studio 21.04 * KDE Plasma Version 5.21.4 * KDE Frameworks Version 5.80.0 * Qt Version 5.15.2 * Kernel Version 5.11.0-18-lowlatency * 64-bit OS * X11 Graphics Platform - HARDWARE - * 4xAMD A8-6410 APU with AMD Radeon R5 Graphics * 6.7 GiB of RAM * AMD KABINI ========================================== Apache Server Version 2.4.46 (Ubuntu) mod_jk/1.2.48, prefork, built 2021-03-09T00:45:35
    – TheGeeko61
    Jun 16, 2021 at 6:09
  • I would suggest to create a new question based on your comment ...
    – Clerenz
    Jun 22, 2021 at 12:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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