Options FollowSymLinks and SymLinksIfOwnerMatch are both off

October 15, 2015 9.1k views
Apache Drupal CMS DigitalOcean Articles Ubuntu

I've followed the DO tutorial to prep putting a local Drupal site onto DO. However, I'm running into an issue where neither my images or CSS are loading.

Browser error is

You don't have permission to access /sites/default/files/css/css_61lFZluJMFLY7Y9wlzSCNhfELFBCk95Gx8CMTJ-PHik.css on this server.

Looking at the Apache error logs I see

Options FollowSymLinks and SymLinksIfOwnerMatch are both off, so the RewriteRule directive is also forbidden due to its similar ability to circumvent directory restrictions : /var/www/html/sites/default/files/css/css_Ym1XJtNgZHXd-a2-_28qWIl4WeSufObTpGk2jgFS0uI.css

I've followed the Ubuntu setup & LAMP setup tutorials to this point. My site does load, just sans images and styles which are kind of important.

Apache host config like so

<VirtualHost *:80>
    # The ServerName directive sets the request scheme, hostname and port that
    # the server uses to identify itself. This is used when creating
    # redirection URLs. In the context of virtual hosts, the ServerName
    # specifies what hostname must appear in the request's Host: header to
    # match this virtual host. For the default virtual host (this file) this
    # value is not decisive as it is used as a last resort host regardless.
    # However, you must set it for any further virtual host explicitly.

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html
    <Directory /var/www/html>
    AllowOverride All
    Order deny,allow
    Allow from all
    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
    # error, crit, alert, emerg.
    # It is also possible to configure the loglevel for particular
    # modules, e.g.
    #LogLevel info ssl:warn

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    # For most configuration files from conf-available/, which are
    # enabled or disabled at a global level, it is possible to
    # include a line for only one particular virtual host. For example the
    # following line enables the CGI configuration for this host only
    # after it has been globally disabled with "a2disconf".
    #Include conf-available/serve-cgi-bin.conf

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

Anyone have any ideas?

1 Answer

Drupal installs an .htaccess. It should be found in the document root. Depending on the version the SymLink options may not be explicitly enabled. See the discussion in this Drupal bug report and the ones linked from it. You can enable it by adding Options +SymLinksIfOwnerMatch to your .htaccess or in your Apache config by adding:

    <Directory /var/www/html>
        Options +SymLinksIfOwnerMatch
        AllowOverride All
        Order deny,allow
        Allow from all
Have another answer? Share your knowledge.