Craig Francis


Apache Checks

If you have ever had a production server do something you did not expect, I find that having a quick reference guide is always handy to have lying around.

Directory index forbidden by rule

If this happens, and the error log might be showing 'You don't have permission to access / on this server', then...

  1. Check that the user the web server process is running under has permission to view the folder and files.

    For example, if the file is owned by 'root' with the folder having a chmod of '700', then the 'apache' user wont be able to access that folder.

  2. Check if the websites folder has been moved out of the default folder for websites (e.g. /var/www/). If it has, then there might be an old <Directory> tag, like the following, which needs to be updated:

    <Directory "/var/www">
    Order allow,deny
    Allow from all
    </Directory>
    <Directory "/www">
    Order allow,deny
    Allow from all
    </Directory>
  3. Check that all of the 'Options' directives are correctly used. Run something like the following to check...

    grep -r "Options" /etc/httpd/conf

    Typically they should be found within a <Directory> tag, as the alternative <Location> tag does not cater for different URLs which may map to the fame file-system location

    Also, please note that if all of the values in the 'Options' directives are prefixed with a '-' or '+' then they are merged with any previous values... if they are simply stated, then they replace any previous values.

  4. Check that SELinux is not having an effect... For a quick fix, just edit '/etc/selinux/config' and set 'SELINUX=disabled'... you will need to restart the server for this to take effect.

General notes

If the '.htaccess' files are being ignored, check that 'AllowOverride' isn't set to 'None'.