From 4182a0805219d0d1793cf3a80f63ec095aeb3716 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 13 Aug 2015 14:02:42 -0300 Subject: [PATCH] Bug 13791: Apache configuration files This patch adds an include to each VirtualHost definition (OPAC and Intranet) and a variable definition, taking advantage of Apache 2.4.x features. The instance name is reused inside the includes providing a simple way of dealing with the apache <-> plack configuration. A check for the right apache version is introduced, in the for of an IfVersion block: = 2.4> --- Plack configuration here --- Signed-off-by: Josef Moravec Signed-off-by: Jonathan Druart Signed-off-by: Tomas Cohen Arazi --- .../apache-shared-intranet-plack.conf | 25 +++++++++++++++++++ .../templates/apache-shared-opac-plack.conf | 25 +++++++++++++++++++ debian/templates/apache-site.conf.in | 8 ++++++ 3 files changed, 58 insertions(+) create mode 100644 debian/templates/apache-shared-intranet-plack.conf create mode 100644 debian/templates/apache-shared-opac-plack.conf diff --git a/debian/templates/apache-shared-intranet-plack.conf b/debian/templates/apache-shared-intranet-plack.conf new file mode 100644 index 0000000000..95a68d51f4 --- /dev/null +++ b/debian/templates/apache-shared-intranet-plack.conf @@ -0,0 +1,25 @@ +# Apache configuration settings that are shared for every Koha instance. +# This file contains settings for the Plack configuration of the intranet. +# +# This file should be included from an instance's +# /etc/apache2/site-available file, from within the VirtualHost section +# for the intranet. + +# Plack is only available out-of-the-box for Apache 2.4.7+ setups += 2.4> + + + ProxyPreserveHost On + + # RequestHeader set X-FORWARDED-PROTO "https" + + # Point the intranet site to Plack + ProxyPass /cgi-bin/koha "unix:/var/run/koha/${instance}/plack.sock|http://localhost/intranet" + ProxyPassReverse /cgi-bin/koha "unix:/var/run/koha/${instance}/plack.sock|http://localhost/intranet" + + # Point the /api endpoint to Plack + # ProxyPass /api "unix:/var/run/koha/${instance}/plack.sock|http://localhost/api" + # ProxyPassReverse /api "unix:/var/run/koha/${instance}/plack.sock|http://localhost/api" + + + diff --git a/debian/templates/apache-shared-opac-plack.conf b/debian/templates/apache-shared-opac-plack.conf new file mode 100644 index 0000000000..5d6f564373 --- /dev/null +++ b/debian/templates/apache-shared-opac-plack.conf @@ -0,0 +1,25 @@ +# Apache configuration settings that are shared for every Koha instance. +# This file contains settings for the Plack configuration of the OPAC. +# +# This file should be included from an instance's +# /etc/apache2/site-available file, from within the VirtualHost section +# for the OPAC. + +# Plack is only available out-of-the-box for Apache 2.4.7+ setups += 2.4> + + + ProxyPreserveHost On + + # RequestHeader set X-FORWARDED-PROTO "https" + + # Point the intranet site to Plack + ProxyPass /cgi-bin/koha "unix:/var/run/koha/${instance}/plack.sock|http://localhost/opac" + ProxyPassReverse /cgi-bin/koha "unix:/var/run/koha/${instance}/plack.sock|http://localhost/opac" + + # Point the /api endpoint to Plack + # ProxyPass /api "unix:/var/run/koha/${instance}/plack.sock|http://localhost/api" + # ProxyPassReverse /api "unix:/var/run/koha/${instance}/plack.sock|http://localhost/api" + + + diff --git a/debian/templates/apache-site.conf.in b/debian/templates/apache-site.conf.in index dd30bc6613..3f7ad5289d 100644 --- a/debian/templates/apache-site.conf.in +++ b/debian/templates/apache-site.conf.in @@ -2,8 +2,12 @@ # OPAC + = 2.4> + Define instance "__KOHASITE__" + Include /etc/koha/apache-shared.conf # Include /etc/koha/apache-shared-disable.conf +# Include /etc/koha/apache-shared-opac-plack.conf Include /etc/koha/apache-shared-opac.conf ServerName __OPACSERVER__ @@ -19,8 +23,12 @@ # Intranet + = 2.4> + Define instance "__KOHASITE__" + Include /etc/koha/apache-shared.conf # Include /etc/koha/apache-shared-disable.conf +# Include /etc/koha/apache-shared-intranet-plack.conf Include /etc/koha/apache-shared-intranet.conf ServerName __INTRASERVER__ -- 2.39.5