From 0c5f126d441b0d3966af37413990eb85ebc656f8 Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Fri, 19 Apr 2013 11:06:27 -0400 Subject: [PATCH] Merge changes to Apache 2.4 example config files Not only do we need the JSPAC->TPAC changes that went into the base Apache example configs, we should also move to generating these files instead of having hardcoded values. Longer term, we should probably just generate the right example configs from one common base until Apache 2.2 is dead and gone, but this improves the Apache 2.4 experience greatly. Signed-off-by: Dan Scott Signed-off-by: Mike Rylander --- .../apache_24/{eg.conf => eg.conf.in} | 32 ++++----- .../{eg_vhost.conf => eg_vhost.conf.in} | 66 +++++++++++++++---- Open-ILS/src/Makefile.am | 10 ++- 3 files changed, 80 insertions(+), 28 deletions(-) rename Open-ILS/examples/apache_24/{eg.conf => eg.conf.in} (84%) rename Open-ILS/examples/apache_24/{eg_vhost.conf => eg_vhost.conf.in} (89%) diff --git a/Open-ILS/examples/apache_24/eg.conf b/Open-ILS/examples/apache_24/eg.conf.in similarity index 84% rename from Open-ILS/examples/apache_24/eg.conf rename to Open-ILS/examples/apache_24/eg.conf.in index c7b8be9143..a62c476f8b 100644 --- a/Open-ILS/examples/apache_24/eg.conf +++ b/Open-ILS/examples/apache_24/eg.conf.in @@ -2,11 +2,11 @@ LogLevel info # - log locally -CustomLog /var/log/apache2/access.log combined -ErrorLog /var/log/apache2/error.log +# CustomLog /var/log/apache2/access.log combined +# ErrorLog /var/log/apache2/error.log # - log to syslog -# CustomLog "|/usr/bin/logger -p local7.info" common -# ErrorLog "|logger -p local7.error" +CustomLog "|/usr/bin/logger -p local7.info" common +ErrorLog syslog:local7 # ---------------------------------------------------------------------------------- @@ -14,7 +14,7 @@ ErrorLog /var/log/apache2/error.log # ---------------------------------------------------------------------------------- # - needed by CGIs -PerlRequire /etc/apache2/startup.pl +PerlRequire /etc/apache2/eg_startup PerlChildInitHandler OpenILS::WWW::Reporter::child_init PerlChildInitHandler OpenILS::WWW::SuperCat::child_init PerlChildInitHandler OpenILS::WWW::AddedContent::child_init @@ -24,7 +24,7 @@ PerlChildInitHandler OpenILS::WWW::AutoSuggest::child_init # ---------------------------------------------------------------------------------- # Set some defaults for our working directories # ---------------------------------------------------------------------------------- - + Require all granted @@ -32,7 +32,7 @@ PerlChildInitHandler OpenILS::WWW::AutoSuggest::child_init # ---------------------------------------------------------------------------------- # XUL directory # ---------------------------------------------------------------------------------- - + Options Indexes FollowSymLinks AllowOverride None Require all granted @@ -42,17 +42,17 @@ PerlChildInitHandler OpenILS::WWW::AutoSuggest::child_init # ---------------------------------------------------------------------------------- # Remove the language portion from the URL # ---------------------------------------------------------------------------------- -AliasMatch ^/opac/.*/skin/(.*)/(.*)/(.*) /openils/var/web/opac/skin/$1/$2/$3 -AliasMatch ^/opac/.*/extras/slimpac/(.*) /openils/var/web/opac/extras/slimpac/$1 -AliasMatch ^/opac/.*/extras/selfcheck/(.*) /openils/var/web/opac/extras/selfcheck/$1 +AliasMatch ^/opac/.*/skin/(.*)/(.*)/(.*) @localstatedir@/web/opac/skin/$1/$2/$3 +AliasMatch ^/opac/.*/extras/slimpac/(.*) @localstatedir@/web/opac/extras/slimpac/$1 +AliasMatch ^/opac/.*/extras/selfcheck/(.*) @localstatedir@/web/opac/extras/selfcheck/$1 # ---------------------------------------------------------------------------------- # System config CGI scripts go here # ---------------------------------------------------------------------------------- -Alias /cgi-bin/offline/ "/openils/var/cgi-bin/offline/" - +Alias /cgi-bin/offline/ "@localstatedir@/cgi-bin/offline/" + AddHandler cgi-script .cgi .pl AllowOverride None Options None @@ -64,8 +64,8 @@ Alias /cgi-bin/offline/ "/openils/var/cgi-bin/offline/" # ---------------------------------------------------------------------------------- # Updates folder # ---------------------------------------------------------------------------------- -Alias /updates/ "/openils/var/updates/pub/" - +Alias /updates/ "@localstatedir@/updates/pub/" + ForceType cgi-script @@ -102,7 +102,7 @@ ExpiresByType text/css "access plus 50 minutes" #Listen 443 NameVirtualHost *:443 - DocumentRoot "/openils/var/web" + DocumentRoot "@localstatedir@/web" ServerName localhost:443 ServerAlias 127.0.0.1:443 SSLEngine on @@ -139,7 +139,7 @@ NameVirtualHost *:443 ServerName localhost:80 ServerAlias 127.0.0.1:80 - DocumentRoot /openils/var/web/ + DocumentRoot @localstatedir@/web/ DirectoryIndex index.xml index.html index.xhtml # - absorb the shared virtual host settings Include eg_vhost.conf diff --git a/Open-ILS/examples/apache_24/eg_vhost.conf b/Open-ILS/examples/apache_24/eg_vhost.conf.in similarity index 89% rename from Open-ILS/examples/apache_24/eg_vhost.conf rename to Open-ILS/examples/apache_24/eg_vhost.conf.in index a5e3fcf89c..b606c0201f 100644 --- a/Open-ILS/examples/apache_24/eg_vhost.conf +++ b/Open-ILS/examples/apache_24/eg_vhost.conf.in @@ -6,7 +6,7 @@ # ---------------------------------------------------------------------------------- # Point / to the opac - if you have a custom skin or locale, point at it here # ---------------------------------------------------------------------------------- -RedirectMatch 301 ^/$ /opac/en-US/skin/default/xml/index.xml +RedirectMatch 301 ^/$ /eg/opac/home # ---------------------------------------------------------------------------------- # Point / to the IP address redirector @@ -35,7 +35,7 @@ RedirectMatch 301 ^/opac/extras/slimpac/advanced.html$ /opac/en-US/extras/slimpa # ---------------------------------------------------------------------------------- # Configure the gateway # ---------------------------------------------------------------------------------- -OSRFGatewayConfig /openils/conf/opensrf_core.xml +OSRFGatewayConfig @sysconfdir@/opensrf_core.xml # Translator memcache server. Default is localhost # OSRFTranslatorCacheServer 127.0.0.1:11211 @@ -86,6 +86,50 @@ RewriteRule . - [E=OILS_OPAC_RID:%2,E=OILS_TIME_YEAR:%{TIME_YEAR}] RewriteCond %{REQUEST_URI} ^/opac/(.*?)/ RewriteRule . - [E=locale:%1] +# ---------------------------------------------------------------------------------- +# Rewrite JSPac->TPac with redirects +# ---------------------------------------------------------------------------------- + +# First things first, extract useful data +# And we are going to start with a "this is the JSPac" check on each of these: +# RewriteCond %{REQUEST_URI} ^/?opac/ + +# Basic (overall) search type, if present +# I am cheating and grabbing RT or TP because I dunno the difference between them. +RewriteCond %{REQUEST_URI} ^/opac/ +RewriteCond %{QUERY_STRING} (^|[^0-9a-zA-Z])(rt|tp)=([^;&]*) +RewriteRule . - [E=OILS_JSPAC_SEARCH_TYPE:qtype=%3;] + +# Basic (overall) search term(s), if present - NOTE: Not doing advanced search. +RewriteCond %{REQUEST_URI} ^/opac/ +RewriteCond %{QUERY_STRING} (^|[^0-9a-zA-Z])t=([^;&]*) +RewriteRule . - [E=OILS_JSPAC_SEARCH_TERMS:query=%2;] + +# Search Location, if present +RewriteCond %{REQUEST_URI} ^/opac/ +RewriteCond %{QUERY_STRING} (^|[^0-9a-zA-Z])l=([^;&]*) +RewriteRule . - [E=OILS_JSPAC_SEARCH_LOCATION:locg=%2;] + +# My Account +RewriteRule /opac/[^/]*/skin/default/xml/myopac.xml /eg/opac/myopac/main?%{ENV:OILS_JSPAC_SEARCH_TYPE}%{ENV:OILS_JSPAC_SEARCH_TERMS}%{ENV:OILS_JSPAC_SEARCH_LOCATION} [NE,R,L] + +# Record Pages +# /opac/en-US/skin/default/xml/rdetail.xml?r=32 -> /eg/opac/record/32 +RewriteCond %{QUERY_STRING} (^|[^0-9a-zA-Z])r=([^;&]*) +RewriteRule /opac/.*/rdetail.xml /eg/opac/record/%2?%{ENV:OILS_JSPAC_SEARCH_TYPE}%{ENV:OILS_JSPAC_SEARCH_TERMS}%{ENV:OILS_JSPAC_SEARCH_LOCATION} [NE,R,L] + +# Bookbag Pages +# /opac/extras/feed/bookbag/html-full/1 -> /eg/opac/results?bookbag=1;page=0;locg=1;depth=0 +RewriteRule /opac/extras/feed/bookbag/html-full/(\d*) /eg/opac/results?bookbag=$1;%{ENV:OILS_JSPAC_SEARCH_TYPE}%{ENV:OILS_JSPAC_SEARCH_TERMS}%{ENV:OILS_JSPAC_SEARCH_LOCATION} [NE,R,L] + +# Search Results Pages +RewriteRule /opac/[^/]*/skin/[^/]*/xml/rresult.xml /eg/opac/results?%{ENV:OILS_JSPAC_SEARCH_TYPE}%{ENV:OILS_JSPAC_SEARCH_TERMS}%{ENV:OILS_JSPAC_SEARCH_LOCATION} [NE,R,L] + +# Basic Search (STILL not doing advanced) +# Fallback! But only for things that end in xml, htm, or html +# Images, CSS, etc can stick around. +RewriteRule /opac/[^/]*/skin/.*(xml|htm|html|/)$ /eg/opac/home?%{ENV:OILS_JSPAC_SEARCH_TYPE}%{ENV:OILS_JSPAC_SEARCH_TERMS}%{ENV:OILS_JSPAC_SEARCH_LOCATION} [NE,R,L] + # ---------------------------------------------------------------------------------- # For sanity reasons, default indexes to Off # ---------------------------------------------------------------------------------- @@ -353,7 +397,7 @@ RewriteRule .? - [E=locale:%{HTTP:Accept-Language}] # ---------------------------------------------------------------------------------- # Module for processing staff-client offline scripts lives here # ---------------------------------------------------------------------------------- - + AddHandler cgi-script .pl AllowOverride None Options +ExecCGI @@ -551,7 +595,7 @@ RewriteRule ^/conify/([a-z]{2}-[A-Z]{2})/global/(.*)$ /conify/global/$2 [E=local # OpenURL 0.1 searching based on OpenSearch -RewriteMap openurl prg:/openils/bin/openurl_map.pl +RewriteMap openurl prg:@bindir@/openurl_map.pl RewriteCond %{QUERY_STRING} (^.*$) RewriteRule ^/openurl$ ${openurl:%1} [NE,PT] @@ -566,7 +610,7 @@ RewriteRule ^/openurl$ ${openurl:%1} [NE,PT] Require all granted PerlSetVar OILSWebBasePath "/eg" - PerlSetVar OILSWebWebDir "/openils/var/web" + PerlSetVar OILSWebWebDir "@localstatedir@/web" PerlSetVar OILSWebDefaultTemplateExtension "tt2" # Enable Template-Toolkit error debugging messages (apache error log) @@ -589,18 +633,18 @@ RewriteRule ^/openurl$ ${openurl:%1} [NE,PT] # select their preferred locale from a locale picker in the TPAC. # #PerlAddVar OILSWebLocale "en" - #PerlAddVar OILSWebLocale "/openils/var/data/locale/messages.en.po" + #PerlAddVar OILSWebLocale "@localstatedir@/data/locale/messages.en.po" #PerlAddVar OILSWebLocale "en_ca" - #PerlAddVar OILSWebLocale "/openils/var/data/locale/en-CA.po" + #PerlAddVar OILSWebLocale "@localstatedir@/data/locale/en-CA.po" #PerlAddVar OILSWebLocale "fr_ca" - #PerlAddVar OILSWebLocale "/openils/var/data/locale/fr-CA.po" + #PerlAddVar OILSWebLocale "@localstatedir@/data/locale/fr-CA.po" # Set the default locale: defaults to en-US #PerlAddVar OILSWebDefaultLocale "fr_ca" # Templates will be loaded from the following paths in reverse order. - PerlAddVar OILSWebTemplatePath "/openils/var/templates" - #PerlAddVar OILSWebTemplatePath "/openils/var/templates_localskin" + PerlAddVar OILSWebTemplatePath "@localstatedir@/templates" + #PerlAddVar OILSWebTemplatePath "@localstatedir@/templates_localskin" #------------------------------------------------- # Added Content Configuration @@ -659,7 +703,7 @@ RewriteRule ^/openurl$ ${openurl:%1} [NE,PT] PerlSetVar OILSWebContextLoader "OpenILS::WWW::EGKPacLoader" - PerlSetVar KPacConfigFile "/openils/conf/kpac.xml.example" + PerlSetVar KPacConfigFile "@sysconfdir@/kpac.xml.example" ExpiresActive On ExpiresByType text/html "access plus 5 seconds" diff --git a/Open-ILS/src/Makefile.am b/Open-ILS/src/Makefile.am index 47ff2e94fe..e9ccaed23d 100644 --- a/Open-ILS/src/Makefile.am +++ b/Open-ILS/src/Makefile.am @@ -146,7 +146,9 @@ gen_scripts = \ gen_docs = \ $(examples)/apache/eg.conf \ $(examples)/apache/eg_vhost.conf \ - $(examples)/apache/eg_startup + $(examples)/apache/eg_startup \ + $(examples)/apache_24/eg.conf \ + $(examples)/apache_24/eg_vhost.conf bin_SCRIPTS = $(core_scripts) $(gen_scripts) $(reporter_scripts) $(installautojs) @@ -236,6 +238,12 @@ $(examples)/apache/eg_vhost.conf: Makefile $(examples)/apache/eg_vhost.conf.in $(examples)/apache/eg_startup: Makefile $(examples)/apache/eg_startup.in $(do_subst) $(examples)/apache/eg_startup.in > "$@" +$(examples)/apache_24/eg.conf: Makefile $(examples)/apache_24/eg.conf.in + $(do_subst) $(examples)/apache_24/eg.conf.in > "$@" + +$(examples)/apache_24/eg_vhost.conf: Makefile $(examples)/apache_24/eg_vhost.conf.in + $(do_subst) $(examples)/apache_24/eg_vhost.conf.in > "$@" + #perl-install and string-templates-install ilscore-install: @echo $@ -- 2.43.2