Home > Guardian Error Handling System > Help > 1020

Using a single instance of Guardian for all sites on a server

This help article describes how to set up a single shared instance of Guardian that handles all errors for all sites on a server. Assumes that the web server is Apache and that you have root access and a command prompt and are very familiar with both.

  1. su; cd /etc/httpd/conf

  2. cp httpd.conf httpd.bak123

  3. apachectl configtest

    (make sure current httpd.conf ok)

  4. pico httpd.conf

  5. Do a find for "/icons/" (Cntrl-W in pico). You'll end up in the place where they set up aliases. Create a guardian alias like:

    Alias /guardian/ "/var/www/guardian/"
    <Directory "/var/www/guardian/">
    	Options ExecCGI
    	AddHandler cgi-script .cgi .pl
    	AllowOverride All
    	Order allow,deny
    	Allow from all
    </Directory>
  6. save httpd.conf (Cntrl-X in pico)

  7. apachectl configtest

    # make sure syntax ok

  8. apachectl restart

    #kick changes

  9. Now do a request for http://{anysite}/guardian/. You should get an empty directory listing corresponding to the folder /var/www/guardian.

    Install Guardian to this folder, so that http://{anysite}/guardian/ag.pl and http://{anysite}/guardian/ag-admin.pl are valid URL's.

    Skip any customization of .htaccess files or ErrorDocument directives at this point. Just make sure that http://{anysite}/guardian/ag.pl works properly and returns the "0 Unknown Error / Unknown URL" message.

  10. cd /etc/httpd/conf; pico httpd.conf

  11. Do a find for "<Directory />" (Cntrl-W in pico). You should have an entry like:

    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>

    Add the error-document handlers:

    <Directory />
    	Options FollowSymLinks
    	AllowOverride None
    	ErrorDocument 401 /guardian/ag.pl
    	ErrorDocument 403 /guardian/ag.pl
    	ErrorDocument 404 /guardian/ag.pl
    	ErrorDocument 500 /guardian/ag.pl
    </Directory>

    These top-level ErrorDocument directives take the place of the ErrorDocument directives in the .htaccess files of each site.

  12. save httpd.conf

  13. apachectl configtest; apachectl restart

All errors will now be directed to the shared instance of Guardian.

Use http://{anysite}/guardian/ag-admin.pl to manage the script.


    "Using a single instance of Guardian for all sites on a server"
    http://www.xav.com/scripts/guardian/help/1020.html