export MKWS_ROOT=$(pwd)/..
MKWS_OS=debian
+APACHE_VERSION=2.2
case $(uname) in
Darwin ) MKWS_OS=macos
test -e libexec || ln -fs /usr/libexec .
;;
Linux ) MKWS_OS=debian
if [ -e /etc/debian_version ]; then
- MKWS_OS=debian
+ MKWS_OS=debian
+ # Ubuntu with Apache 2.2 can continue using debian
+ if /usr/bin/dpkg -s apache2 | grep -q "Version: 2\.4\..*ubuntu"; then
+ MKWS_OS=ubuntu
+ APACHE_VERSION=2.4
+ fi
fi
if [ -e /etc/redhat-release ]; then
MKWS_OS=centos
export APACHE_MODULES="$MKWS_ROOT/tools/apache2/jasmine-dev.apache-modules.$MKWS_OS.conf"
-: ${MKWS_APACHE_TEMPLATE="$MKWS_ROOT/tools/apache2/jasmine-dev.template"}
+if [ "$APACHE_VERSION" = "2.4" ]; then
+ : ${MKWS_APACHE_TEMPLATE="$MKWS_ROOT/tools/apache2/jasmine-dev.template-2.4"}
+else
+ : ${MKWS_APACHE_TEMPLATE="$MKWS_ROOT/tools/apache2/jasmine-dev.template"}
+fi
: ${MKWS_APACHE_FILE="$APACHE_LOG_DIR/jasmine-dev"}
+
perl -npe 's,\${(.*?)},$ENV{$1},g; ' $MKWS_APACHE_TEMPLATE > $MKWS_APACHE_FILE.tmp
mv -f $MKWS_APACHE_FILE.tmp $MKWS_APACHE_FILE
-
--- /dev/null
+Include /etc/apache2/mods-available/alias.load
+Include /etc/apache2/mods-available/authz*.load
+Include /etc/apache2/mods-available/proxy*.load
+Include /etc/apache2/mods-available/rewrite.load
+Include /etc/apache2/mods-available/headers.load
+Include /etc/apache2/mods-available/mime.load
+Include /etc/apache2/mods-available/deflate.load
+
+Include /etc/apache2/mods-available/alias*.conf
+Include /etc/apache2/mods-available/proxy*.conf
+Include /etc/apache2/mods-available/mime.conf
+Include /etc/apache2/mods-available/deflate.conf
+
+Include /etc/apache2/mods-enabled/mpm*conf
+Include /etc/apache2/mods-enabled/mpm*load
+Include /etc/apache2/mods-available/xml2enc.load
+Include /etc/apache2/mods-available/filter.load
+Include /etc/apache2/mods-available/slotmem_shm.load
+
--- /dev/null
+# Configuration for the apache web server -*- apache -*-
+
+#####################################################################
+# global apache2 config
+#
+User ${APACHE_RUN_USER}
+Group ${APACHE_RUN_GROUP}
+PidFile ${APACHE_PID_FILE}
+Mutex file:${APACHE_LOG_DIR}
+
+ServerName localhost
+ServerRoot ${APACHE_SERVER_ROOT}
+Listen ${APACHE_PORT}
+
+Include ${APACHE_MODULES}
+
+<IfModule log_config_module>
+ LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
+</IfModule>
+
+# pazpar2 / service proxy config
+<VirtualHost *:${APACHE_PORT}>
+ ServerName localhost
+ ServerAlias mkws-dev a.mkws.indexdata.com a.mkws-dev.indexdata.com mkws-dev.indexdata.com 127.0.0.1
+
+ ServerAdmin webmaster@indexdata.com
+ ErrorLog ${APACHE_LOG_DIR}/mkws-jasmine-error.log
+ CustomLog ${APACHE_LOG_DIR}/mkws-jasmine-access.log combined
+ LogLevel info rewrite:debug
+
+ RewriteEngine on
+
+ DocumentRoot ${MKWS_ROOT}/examples/htdocs
+ Alias /tools/htdocs ${MKWS_ROOT}/tools/htdocs
+ Alias /src ${MKWS_ROOT}/src
+ Alias /test ${MKWS_ROOT}/test
+ Alias /jasmine ${MKWS_ROOT}/examples/jasmine
+
+ # CORS setting
+ Header set Access-Control-Allow-Credentials true
+ Header set Access-Control-Allow-Origin "*"
+
+ # compress text output
+ <Location />
+ AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml
+ SetOutputFilter DEFLATE
+ </Location>
+
+ # jasmine test account
+ RewriteRule /service-proxy-testauth(/)?(;jsessionid=.+)? /service-proxy/$2?command=auth&action=login&username=mkwstest&password=mkwstest [P]
+
+ # mkws devel account (e.g. memached testing)
+ RewriteRule /service-proxy-auth(/)?(;jsessionid=.+)? /service-proxy/$2?command=auth&action=login&username=mkwsdev&password=mkwsdev [P]
+
+ ProxyPass /service-proxy/ http://sp-mkc.indexdata.com/service-proxy/
+ ProxyPassReverse /service-proxy/ http://sp-mkc.indexdata.com/service-proxy/
+
+ ProxyPass /pazpar2/ http://localhost:8004/pazpar2/
+ ProxyPassReverse /pazpar2/ http://localhost:8004/pazpar2/
+
+</VirtualHost>
+