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.
-
su; cd /etc/httpd/conf
-
cp httpd.conf httpd.bak123
-
apachectl configtest
(make sure current httpd.conf ok)
-
pico httpd.conf
-
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>
-
save httpd.conf (Cntrl-X in pico)
-
apachectl configtest
# make sure syntax ok
-
apachectl restart
#kick changes
-
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.
-
cd /etc/httpd/conf; pico httpd.conf
-
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.
-
save httpd.conf
-
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