2

I’m part the team that administrates a Apache 2.4.9 web server running on Debian 7.8. We’re having an issue with one of our users website:

www.example.com/~user

When we try to access this URL, a page loads with the following content:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log. Apache/2.2.22 (Debian) Server at www.cpdee.ufmg.br Port 80

And in /var/log/apache2/error.log I find this:

[Fri Apr 03 11:36:36 2015] [alert] [client 179.214.195.80] /home/web/user/.htaccess: Options not allowed here

If I then look the content of the /home/web/user/.htacces file, there’s just this configuration line:

Options -Indexes

After a quick research, it seemed to me that this issue has to do with Apache’s virtual host configuration. Specifically, this tutorial says that this problem can be fixed by adding “Options” in the “AllowOverride” list of the /etc/apache2/sites-enabled/000-default, like this:

<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride FileInfo Options
    Order allow,deny
    allow from all
</Directory>

This file is just a link to the /etc/apache2/sites-available/default file and, in my case, this file looks a little bit messy:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www
        <Directory />
                Options FollowSymLinks
                AllowOverride Options
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride Options
                Order allow,deny
                allow from all
        </Directory>

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

        ErrorLog ${APACHE_LOG_DIR}/error.log

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

        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

As suggested, I added Options to the AllowOverried list (for each <Directory> ... </Directory> "tag" I found there). Then I enabled the changes and reloaded Apache with this set of commands:

a2ensite default
/etc/init.d/apache2 reload

Even with these changes, I still kept having the same issue and I don’t really know what’s wrong. Could someone please help me with that?

2
  • This looks OK for /var/www but are your user home directories in /var/www or something like /home/user/public_html ? – David Houde Apr 5 '15 at 15:45
  • It's in /home/users/ – Álvaro Lemos Apr 7 '15 at 13:04
2

Check if more specific configuration in userdir.conf overrides settings you specify in <Directory />. In /etc/apache2/mods-enabled/userdir.conf is specified Directory directive for userdir, default is:

<IfModule mod_userdir.c>
        UserDir public_html
        UserDir disabled root

        <Directory /home/*/public_html>
                AllowOverride FileInfo AuthConfig Limit Indexes
                Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
                <Limit GET POST OPTIONS>
                        Order allow,deny
                        Allow from all
                </Limit>
                <LimitExcept GET POST OPTIONS>
                        Order deny,allow
                        Deny from all
                </LimitExcept>
        </Directory>
</IfModule>

So you should add Options to the AllowOverride directive here.

(Probably your directory is <Directory /home/web/*/> instead.)

1
  • Esa, that solved my problem, thank you! And yes, my directory is <Directory /home/web/*/> – Álvaro Lemos Apr 7 '15 at 12:45

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.