ProxyErrorOverride Results in Internal Server Error

Setting ProxyErrorOverride in htaccess results in Internal Server Error.

1310 views
d

By. Jacob

Edited: 2019-12-05 16:22

If you are trying to get ProxyErrorOverride to work and wondering why you are getting the infamous Internal Server Error rather than the beautiful custom error page you have designed for your website, then it might be because you are trying to include it in your .htaccess file.

I was working on implementing a universal 404 error handler, basically letting Beamtic's CMS handle the error rather than Apache or php-fpm. This took me a few hours, since I hate meddling in .htaccess files. The syntax is just too unintuitive, resulting in Internal Server Error. I find it much easier to handle things from PHP.

Anyway, to get it to work, you should instead open up your Virtual Host (VHOST) configuration file. These are often located in /etc/apache2/sites-available/, and would probably look like this, done right:

<VirtualHost *:80>
    DocumentRoot "/var/www/example/"
    ServerName example.com
    ErrorLog ${APACHE_LOG_DIR}/example.com-error.log
    CustomLog ${APACHE_LOG_DIR}/example.com-access.log common

    ProxyErrorOverride On

    <Directory "/var/www/example/">
        Options FollowSymLinks
        AllowOverride All

        Order allow,deny
        Allow from all

    </Directory>

</VirtualHost>

Server configuration

And, now that you are at it, you might as well set AllowOverride to None:

AllowOverride None

Then, configure your VHOSTs from the configuration files instead of using htaccess.

If you got settings that are shared between multiple domains, you can just create a external .conf and include it in your VHOST config files.

Include /usr/local/apache2/conf/my-amazing-stuff.conf

Using the /usr/local/ location should avoid the risk of having your configuration files accidentally overwritten doing system updates.

Links

  1. /usr/local : Local hierarchy - refspecs.linuxfoundation.org
  2. ProxyErrorOverride Directive - apache.org

Tell us what you think:

  1. This article describes configuration issues caused by Apache mischievously picking a default VHOST without telling the user.
  2. In this Tutorial, it is shown how to redirect all HTTP requests to a index.php file using htaccess or Apache configuration files.
  3. How to enable Apache mod_php using a2enmod, and how to find out what the name of the module is.
  4. How to have files uploaded through SFTP correctly inherit the group permissions of the parent directory.

More in: Apache