This is a fix for the problem described in github issue #575.

Some of the changes included here are:
 * make configuration work both on 2.2 and 2.4 version of httpd
 * be more resilient on afe and tko web interface rewrite rules
   to skip URIs that are dealt by django code
 * use conditionals to configure either mod_python or mod_wsgi
 * clean up of old rewrite rules that accounted for old and broken
   packaging of autotest
 * clean up deprecated and empty files
 * move individual config files to relative paths and make install
   script support that

Signed-off-by: Cleber Rosa <[email protected]>
---
 apache/apache-conf                          |  41 ++++-----
 apache/apache-web-conf                      |   6 ++
 apache/conf/afe-directives                  |  22 ++---
 apache/conf/all-directives                  |  14 ---
 apache/conf/apache-conf                     |   2 -
 apache/conf/django-directives               | 135 +++++++++++++++++++++++-----
 apache/conf/embedded-spreadsheet-directives |  15 ----
 apache/conf/embedded-tko-directives         |  15 ----
 apache/conf/favicon-directives              |  22 +----
 apache/conf/new-tko-directives              |  22 ++---
 apache/conf/tko-directives                  |  23 +++--
 contrib/install-autotest-server.sh          |  11 ++-
 12 files changed, 172 insertions(+), 156 deletions(-)
 create mode 100644 apache/apache-web-conf
 delete mode 100644 apache/conf/all-directives
 delete mode 100644 apache/conf/apache-conf
 delete mode 100644 apache/conf/site-directives

diff --git a/apache/apache-conf b/apache/apache-conf
index d9b8e72..5c7a8ee 100644
--- a/apache/apache-conf
+++ b/apache/apache-conf
@@ -1,26 +1,19 @@
-NameVirtualHost *
-<VirtualHost *>
-    DocumentRoot /usr/local/autotest/apache/www/
-    <Directory />
-        Options FollowSymLinks
-        AllowOverride None
-    </Directory>
-    <Directory /usr/local/autotest/apache/www/>
-        Options Indexes FollowSymLinks MultiViews
-        AllowOverride None
-        Order allow,deny
-        allow from all
-    </Directory>
+DocumentRoot /usr/local/autotest/apache/www
+RedirectMatch ^/$ /afe
 
+<IfVersion >= 2.4>
+   <Location />
+      Require all granted
+   </Location>
+</IfVersion>
+<IfVersion < 2.2.99>
+   <Location />
+      Order allow,deny
+      allow from all
+   </Location>
+</IfVersion>
 
-    ErrorLog /var/log/apache2/error.log
-    LogLevel warn
-
-    CustomLog /var/log/apache2/access.log combined
-    ServerSignature On
-
-    RedirectMatch ^/$ /afe
-
-    Include "/usr/local/autotest/apache/conf/all-directives"
-    
-</VirtualHost>
+# Include files relevant to the server code
+Include "autotest.d/django-directives"
+Include "autotest.d/cgi-directives"
+Include "autotest.d/tko-directives"
diff --git a/apache/apache-web-conf b/apache/apache-web-conf
new file mode 100644
index 0000000..2f0a4dc
--- /dev/null
+++ b/apache/apache-web-conf
@@ -0,0 +1,6 @@
+# Include files relevant to the web client code
+Include "autotest.d/afe-directives"
+Include "autotest.d/embedded-spreadsheet-directives"
+Include "autotest.d/embedded-tko-directives"
+Include "autotest.d/gwt-directives"
+Include "autotest.d/new-tko-directives"
diff --git a/apache/conf/afe-directives b/apache/conf/afe-directives
index 9a885ef..fc2be24 100644
--- a/apache/conf/afe-directives
+++ b/apache/conf/afe-directives
@@ -3,27 +3,15 @@ RewriteEngine On
 # This rule is meant for autotest installations under a single directory,
 # such as when pulling the code from git or from a tarball
 RewriteCond /usr/local/autotest/frontend/client/www/autotest.AfeClient -d
-RewriteRule /afe(.*) 
/usr/local/autotest/frontend/client/www/autotest.AfeClient/$1
+RewriteRule ^/afe((?!\/server\/).*)$ 
/usr/local/autotest/frontend/client/www/autotest.AfeClient/$1
 
 # This rule is meant for autotest installations from a package such as RPM
 RewriteCond /usr/share/autotest/frontend/client/www/autotest.AfeClient -d
-RewriteRule /afe(.*) 
/usr/share/autotest/frontend/client/www/autotest.AfeClient/$1
-
-# These rules are fallbacks when autotest web client is installed along
-# the autotest server files, following the same layout as it is currently
-# in the source tree, that is, the "client" directory inside "frontent"
-RewriteCond 
/usr/lib/python2.7/site-packages/autotest/frontend/client/www/autotest.AfeClient
 -d
-RewriteRule /afe(.*) 
/usr/lib/python2.7/site-packages/autotest/frontend/client/www/autotest.AfeClient/$1
-
-RewriteCond 
/usr/lib/python2.6/site-packages/autotest/frontend/client/www/autotest.AfeClient
 -d
-RewriteRule /afe(.*) 
/usr/lib/python2.6/site-packages/autotest/frontend/client/www/autotest.AfeClient/$1
-
-RewriteCond 
/usr/lib/python2.5/site-packages/autotest/frontend/client/www/autotest.AfeClient
 -d
-RewriteRule /afe(.*) 
/usr/lib/python2.5/site-packages/autotest/frontend/client/www/autotest.AfeClient/$1
-
-RewriteCond 
/usr/lib/python2.4/site-packages/autotest/frontend/client/www/autotest.AfeClient
 -d
-RewriteRule /afe(.*) 
/usr/lib/python2.4/site-packages/autotest/frontend/client/www/autotest.AfeClient/$1
+RewriteRule ^/afe((?!\/server\/).*)$ 
/usr/share/autotest/frontend/client/www/autotest.AfeClient/$1
 
 <Location "/afe">
     DirectoryIndex AfeClient.html
+    <IfVersion >= 2.4>
+        Require all granted
+    </IfVersion>
 </Location>
diff --git a/apache/conf/all-directives b/apache/conf/all-directives
deleted file mode 100644
index 8189c5c..0000000
--- a/apache/conf/all-directives
+++ /dev/null
@@ -1,14 +0,0 @@
-# The name is misleading.  These are all the directives for a normal install.
-# This does not include stuff like proxy-directives and some of the files here
-# include other directive files.
-
-Include "/usr/local/autotest/apache/conf/favicon-directives"
-Include "/usr/local/autotest/apache/conf/cgi-directives"
-Include "/usr/local/autotest/apache/conf/gwt-directives"
-Include "/usr/local/autotest/apache/conf/django-directives"
-Include "/usr/local/autotest/apache/conf/afe-directives"
-Include "/usr/local/autotest/apache/conf/tko-directives"
-Include "/usr/local/autotest/apache/conf/new-tko-directives"
-Include "/usr/local/autotest/apache/conf/embedded-tko-directives"
-Include "/usr/local/autotest/apache/conf/embedded-spreadsheet-directives"
-Include "/usr/local/autotest/apache/conf/site-directives"
diff --git a/apache/conf/apache-conf b/apache/conf/apache-conf
deleted file mode 100644
index c888d8c..0000000
--- a/apache/conf/apache-conf
+++ /dev/null
@@ -1,2 +0,0 @@
-# This file is here for backwards compatibility
-Include "/usr/local/autotest/apache/apache-conf"
diff --git a/apache/conf/django-directives b/apache/conf/django-directives
index 9c5d54d..041789a 100644
--- a/apache/conf/django-directives
+++ b/apache/conf/django-directives
@@ -1,46 +1,133 @@
-<IfModule !prefork.c>
-    # Django requires the prefork MPM, so just fail with this bogus directive
-    # if it's not loaded. See
-    # https://github.com/autotest/autotest/wiki/AutotestServerInstall for more 
info.
-    ERROR__DJANGO_REQUIRES_THE_PREFORK_MPM
+#
+# The following prevents a system from having installed and loaded on apache
+# both mod_python and mod_wsgi
+#
+<IfModule mod_wsgi.c>
+   <IfModule mod_python.c>
+      ERROR__EITHER_MOD_WSGI_XOR_MOD_PYTHON_SHOULD_BE_ACTIVE
+   </IfModule>
 </IfModule>
 
 #
-# Try to serve admin media files, no matter where django is actually installed
-# Covers python versions 2.4 through 2.7 and also django installed by 
utils/build_externals.py
+# Django, when running under mod_python, requires the prefork MPM, so just
+# fail with this bogus directive if it's not loaded. For more info see:
+# https://github.com/autotest/autotest/wiki/AutotestServerInstall
 #
+<IfModule !prefork.c>
+    <IfModule mod_python.c>
+       ERROR__DJANGO_REQUIRES_THE_PREFORK_MPM
+    </IfModule>
+</IfModule>
+
 RewriteEngine On
+
+#
+# Django < 1.4 installed by utils/build_externals.py
+#
 RewriteCond /usr/local/autotest/site-packages/django/contrib/admin/media -d
 RewriteRule /media/(css|img|js)(.*) 
/usr/local/autotest/site-packages/django/contrib/admin/media/$1/$2
+RewriteCond /usr/local/autotest/site-packages/django/contrib/admin/media -d
+RewriteRule 
/afe/server/admin/afe/(aclgroup|atomicgroup|host|label|profiler|test)/admin/(css|img|js)(.*)
 /usr/local/autotest/site-packages/django/contrib/admin/admin/$2/$3
 
-# Django 1.4 does change location of the admin css files
+#
+# Django >= 1.4 installed by utils/build_externals.py
+# Since it's not obvious: there's a change in the location of files
+#
 RewriteCond 
/usr/local/autotest/site-packages/django/contrib/admin/static/admin -d
 RewriteRule /media/(css|img|js)(.*) 
/usr/local/autotest/site-packages/django/contrib/admin/static/admin/$1/$2
+RewriteCond 
/usr/local/autotest/site-packages/django/contrib/admin/static/admin -d
+RewriteRule 
/afe/server/admin/afe/(aclgroup|atomicgroup|host|label|profiler|test)/admin/(css|img|js)(.*)
 /usr/local/autotest/site-packages/django/contrib/admin/static/admin/$2/$3
 
-RewriteCond /usr/lib/python2.4/site-packages/django/contrib/admin/media -d
-RewriteRule /media/(css|img|js)(.*) 
/usr/lib/python2.4/site-packages/django/contrib/admin/media/$1/$2
+#
+# Python 2.7 and django >= 1.4 installed by distributions packages
+#
+RewriteCond /usr/lib/python2.7/site-packages/django/contrib/admin/static/admin 
-d
+RewriteRule /media/(css|img|js)(.*) 
/usr/lib/python2.7/site-packages/django/contrib/admin/static/admin/$1/$2
+RewriteCond /usr/lib/python2.7/site-packages/django/contrib/admin/static/admin 
-d
+RewriteRule 
/afe/server/admin/afe/(aclgroup|atomicgroup|host|label|profiler|test)/admin/(css|img|js)(.*)
 /usr/lib/python2.7/site-packages/django/contrib/admin/static/admin/$2/$3
 
-RewriteCond /usr/lib/python2.5/site-packages/django/contrib/admin/media -d
-RewriteRule /media/(css|img|js)(.*) 
/usr/lib/python2.5/site-packages/django/contrib/admin/media/$1/$2
+#
+# Python 2.7 and django < 1.4 installed by distributions packages
+#
+RewriteCond /usr/lib/python2.7/site-packages/django/contrib/admin/media -d
+RewriteRule /media/(css|img|js)(.*) 
/usr/lib/python2.7/site-packages/django/contrib/admin/media/$1/$2
+RewriteCond /usr/lib/python2.7/site-packages/django/contrib/admin/media -d
+RewriteRule 
/afe/server/admin/afe/(aclgroup|atomicgroup|host|label|profiler|test)/admin/(css|img|js)(.*)
 /usr/lib/python2.7/site-packages/django/contrib/admin/admin/$2/$3
 
+#
+# Python 2.6 and django < 1.4 installed by distributions packages
+#
 RewriteCond /usr/lib/python2.6/site-packages/django/contrib/admin/media -d
 RewriteRule /media/(css|img|js)(.*) 
/usr/lib/python2.6/site-packages/django/contrib/admin/media/$1/$2
+RewriteCond /usr/lib/python2.6/site-packages/django/contrib/admin/media -d
+RewriteRule 
/afe/server/admin/afe/(aclgroup|atomicgroup|host|label|profiler|test)/admin/(css|img|js)(.*)
 /usr/lib/python2.6/site-packages/django/contrib/admin/admin/$2/$3
 
-RewriteCond /usr/lib/python2.7/site-packages/django/contrib/admin/media -d
-RewriteRule /media/(css|img|js)(.*) 
/usr/lib/python2.7/site-packages/django/contrib/admin/media/$1/$2
+#
+# Python 2.5 and django < 1.4 installed by distributions packages
+#
+RewriteCond /usr/lib/python2.5/site-packages/django/contrib/admin/media -d
+RewriteRule /media/(css|img|js)(.*) 
/usr/lib/python2.5/site-packages/django/contrib/admin/media/$1/$2
+RewriteCond /usr/lib/python2.5/site-packages/django/contrib/admin/media -d
+RewriteRule 
/afe/server/admin/afe/(aclgroup|atomicgroup|host|label|profiler|test)/admin/(css|img|js)(.*)
 /usr/lib/python2.5/site-packages/django/contrib/admin/admin/$2/$3
 
-# Django 1.4 does change location of the admin css files
-RewriteCond /usr/lib/python2.7/site-packages/django/contrib/admin/static/admin 
-d
-RewriteRule /media/(css|img|js)(.*) 
/usr/lib/python2.7/site-packages/django/contrib/admin/static/admin/$1/$2
+#
+# Python 2.4 and django < 1.4 installed by distributions packages
+#
+RewriteCond /usr/lib/python2.4/site-packages/django/contrib/admin/media -d
+RewriteRule /media/(css|img|js)(.*) 
/usr/lib/python2.4/site-packages/django/contrib/admin/media/$1/$2
+RewriteCond /usr/lib/python2.4/site-packages/django/contrib/admin/media -d
+RewriteRule 
/afe/server/admin/afe/(aclgroup|atomicgroup|host|label|profiler|test)/admin/(css|img|js)(.*)
 /usr/lib/python2.4/site-packages/django/contrib/admin/admin/$2/$3
 
+#
+# Generic Python shared dir and django < 1.4 installed by Debian like packages
+#
+RewriteCond /usr/share/pyshared/django/contrib/admin/media -d
+RewriteRule /media/(css|img|js)(.*) 
/usr/share/pyshared/django/contrib/admin/media/$1/$2
+RewriteCond /usr/share/pyshared/django/contrib/admin/media -d
+RewriteRule 
/afe/server/admin/afe/(aclgroup|atomicgroup|host|label|profiler|test)/admin/(css|img|js)(.*)
 /usr/share/pyshared/django/contrib/admin/media$2/$3
+
+#
 # Configuration for mod_wsgi
-RewriteRule ^/(afe|new_tko)/server(.*)$ /$1/server$2 [QSA,PT,L]
+#
+<IfModule mod_wsgi.c>
+
+    RewriteCond /usr/local/autotest/frontend/frontend.wsgi -f
+    RewriteRule /(afe|new_tko)/server(.*) 
/usr/local/autotest/frontend/frontend.wsgi [H=wsgi-script]
+
+    RewriteCond 
/usr/lib/python2.7/site-packages/autotest/frontend/frontend.wsgi -f
+    RewriteRule /(afe|new_tko)/server(.*) 
/usr/lib/python2.7/site-packages/autotest/frontend/frontend.wsgi [H=wsgi-script]
 
-WSGISocketPrefix run/wsgi
+    RewriteCond 
/usr/lib/python2.6/site-packages/autotest/frontend/frontend.wsgi -f
+    RewriteRule /(afe|new_tko)/server(.*) 
/usr/lib/python2.6/site-packages/autotest/frontend/frontend.wsgi [H=wsgi-script]
 
-WSGIScriptAliasMatch /(afe|new_tko)/server.* 
/usr/local/autotest/frontend/frontend.wsgi
+    RewriteCond 
/usr/lib/python2.5/site-packages/autotest/frontend/frontend.wsgi -f
+    RewriteRule /(afe|new_tko)/server(.*) 
/usr/lib/python2.5/site-packages/autotest/frontend/frontend.wsgi [H=wsgi-script]
 
-<Directory /usr/local/autotest/frontend/>
-    Order allow,deny
-    Allow from all
-</Directory>
+    RewriteCond 
/usr/lib/python2.4/site-packages/autotest/frontend/frontend.wsgi -f
+    RewriteRule /(afe|new_tko)/server(.*) 
/usr/lib/python2.4/site-packages/autotest/frontend/frontend.wsgi [H=wsgi-script]
+
+    <LocationMatch "/(afe|new_tko)/server(.*)">
+       Options +ExecCGI
+    </LocationMatch>
+
+    WSGISocketPrefix run/wsgi
+    WSGIDaemonProcess apache processes=10 threads=1
+    WSGIProcessGroup apache
+</IfModule>
+
+#
+# Configuration for mod_python
+#
+<IfModule mod_python.c>
+    <Location ~ "/(afe|new_tko)/server">
+        SetHandler python-program
+        PythonHandler django.core.handlers.modpython
+        SetEnv DJANGO_SETTINGS_MODULE frontend.settings
+        PythonDebug On
+        # Force our own site-packages to be loaded by mod_python prior to
+       # mod_python's system python site-packages directory.
+        # This way our code can depend on library versions other than
+        # those available as packages on various OS distributions.
+        PythonPath "['/usr/local/autotest/site-packages', 
'/usr/local/autotest', '/usr/lib/python2.7/site-packages/autotest', 
'/usr/lib/python2.6/site-packages/autotest', 
'/usr/lib/python2.5/site-packages/autotest', 
'/usr/lib/python2.4/site-packages/autotest'] + sys.path"
+    </Location>
+</IfModule>
diff --git a/apache/conf/embedded-spreadsheet-directives 
b/apache/conf/embedded-spreadsheet-directives
index 511b24e..360ec17 100644
--- a/apache/conf/embedded-spreadsheet-directives
+++ b/apache/conf/embedded-spreadsheet-directives
@@ -8,18 +8,3 @@ RewriteRule /embedded_spreadsheet(.*) 
/usr/local/autotest/frontend/client/www/au
 # This rule is meant for autotest installations from a package such as RPM
 RewriteCond 
/usr/share/autotest/frontend/client/www/autotest.EmbeddedSpreadsheetClient -d
 RewriteRule /embedded_spreadsheet(.*) 
/usr/share/autotest/frontend/client/www/autotest.EmbeddedSpreadsheetClient/$1
-
-# These rules are fallbacks when autotest web client is installed along
-# the autotest server files, following the same layout as it is currently
-# in the source tree, that is, the "client" directory inside "frontent"
-RewriteCond 
/usr/lib/python2.7/site-packages/autotest/frontend/client/www/autotest.EmbeddedSpreadsheetClient
 -d
-RewriteRule /embedded_spreadsheet(.*) 
/usr/lib/python2.7/site-packages/autotest/frontend/client/www/autotest.EmbeddedSpreadsheetClient/$1
-
-RewriteCond 
/usr/lib/python2.6/site-packages/autotest/frontend/client/www/autotest.EmbeddedSpreadsheetClient
 -d
-RewriteRule /embedded_spreadsheet(.*) 
/usr/lib/python2.6/site-packages/autotest/frontend/client/www/autotest.EmbeddedSpreadsheetClient/$1
-
-RewriteCond 
/usr/lib/python2.5/site-packages/autotest/frontend/client/www/autotest.EmbeddedSpreadsheetClient
 -d
-RewriteRule /embedded_spreadsheet(.*) 
/usr/lib/python2.5/site-packages/autotest/frontend/client/www/autotest.EmbeddedSpreadsheetClient/$1
-
-RewriteCond 
/usr/lib/python2.4/site-packages/autotest/frontend/client/www/autotest.EmbeddedSpreadsheetClient
 -d
-RewriteRule /embedded_spreadsheet(.*) 
/usr/lib/python2.4/site-packages/autotest/frontend/client/www/autotest.EmbeddedSpreadsheetClient/$1
diff --git a/apache/conf/embedded-tko-directives 
b/apache/conf/embedded-tko-directives
index affc623..3aab851 100644
--- a/apache/conf/embedded-tko-directives
+++ b/apache/conf/embedded-tko-directives
@@ -8,18 +8,3 @@ RewriteRule /embedded_tko(.*) 
/usr/local/autotest/frontend/client/www/autotest.E
 # This rule is meant for autotest installations from a package such as RPM
 RewriteCond /usr/share/autotest/frontend/client/www/autotest.EmbeddedTkoClient 
-d
 RewriteRule /embedded_tko(.*) 
/usr/share/autotest/frontend/client/www/autotest.EmbeddedTkoClient/$1
-
-# These rules are fallbacks when autotest web client is installed along
-# the autotest server files, following the same layout as it is currently
-# in the source tree, that is, the "client" directory inside "frontent"
-RewriteCond 
/usr/lib/python2.7/site-packages/autotest/frontend/client/www/autotest.EmbeddedTkoClient
 -d
-RewriteRule /embedded_tko(.*) 
/usr/lib/python2.7/site-packages/autotest/frontend/client/www/autotest.EmbeddedTkoClient/$1
-
-RewriteCond 
/usr/lib/python2.6/site-packages/autotest/frontend/client/www/autotest.EmbeddedTkoClient
 -d
-RewriteRule /embedded_tko(.*) 
/usr/lib/python2.6/site-packages/autotest/frontend/client/www/autotest.EmbeddedTkoClient/$1
-
-RewriteCond 
/usr/lib/python2.5/site-packages/autotest/frontend/client/www/autotest.EmbeddedTkoClient
 -d
-RewriteRule /embedded_tko(.*) 
/usr/lib/python2.5/site-packages/autotest/frontend/client/www/autotest.EmbeddedTkoClient/$1
-
-RewriteCond 
/usr/lib/python2.4/site-packages/autotest/frontend/client/www/autotest.EmbeddedTkoClient
 -d
-RewriteRule /embedded_tko(.*) 
/usr/lib/python2.4/site-packages/autotest/frontend/client/www/autotest.EmbeddedTkoClient/$1
diff --git a/apache/conf/favicon-directives b/apache/conf/favicon-directives
index 366026b..b064b37 100644
--- a/apache/conf/favicon-directives
+++ b/apache/conf/favicon-directives
@@ -1,6 +1,3 @@
-RewriteEngine on
-RewriteRule /favicon.ico /usr/local/autotest/apache/www/favicon.ico
-
 RewriteEngine On
 
 # This rule is meant for autotest installations under a single directory,
@@ -9,20 +6,5 @@ RewriteCond /usr/local/autotest/apache/www/favicon.ico -f
 RewriteRule /favicon.ico /usr/local/autotest/apache/www/favicon.ico
 
 # This rule is meant for autotest installations from a package such as RPM
-RewriteCond /usr/share/autotest/apache/www/favicon.ico -f
-RewriteRule /favicon.ico /usr/share/autotest/apache/www/favicon.ico
-
-# These rules are fallbacks when autotest web client is installed along
-# the autotest server files, following the same layout as it is currently
-# in the source tree, that is, the "client" directory inside "frontent"
-RewriteCond /usr/lib/python2.7/site-packages/autotest/apache/www/favicon.ico -f
-RewriteRule /favicon.ico 
/usr/lib/python2.7/site-packages/autotest/apache/www/favicon.ico
-
-RewriteCond /usr/lib/python2.6/site-packages/autotest/apache/www/favicon.ico -f
-RewriteRule /favicon.ico 
/usr/lib/python2.6/site-packages/autotest/apache/www/favicon.ico
-
-RewriteCond /usr/lib/python2.5/site-packages/autotest/apache/www/favicon.ico -f
-RewriteRule /favicon.ico 
/usr/lib/python2.5/site-packages/autotest/apache/www/favicon.ico
-
-RewriteCond /usr/lib/python2.4/site-packages/autotest/apache/www/favicon.ico -f
-RewriteRule /favicon.ico 
/usr/lib/python2.4/site-packages/autotest/apache/www/favicon.ico
+RewriteCond /usr/share/autotest/www/favicon.ico -f
+RewriteRule /favicon.ico /usr/share/autotest/www/favicon.ico
diff --git a/apache/conf/new-tko-directives b/apache/conf/new-tko-directives
index 65123ca..90e1b49 100644
--- a/apache/conf/new-tko-directives
+++ b/apache/conf/new-tko-directives
@@ -3,27 +3,15 @@ RewriteEngine On
 # This rule is meant for autotest installations under a single directory,
 # such as when pulling the code from git or from a tarball
 RewriteCond /usr/local/autotest/frontend/client/www/autotest.TkoClient -d
-RewriteRule /new_tko(.*) 
/usr/local/autotest/frontend/client/www/autotest.TkoClient/$1
+RewriteRule /new_tko((?!\/server\/).*)$ 
/usr/local/autotest/frontend/client/www/autotest.TkoClient/$1
 
 # This rule is meant for autotest installations from a package such as RPM
 RewriteCond /usr/share/autotest/frontend/client/www/autotest.TkoClient -d
-RewriteRule /new_tko(.*) 
/usr/share/autotest/frontend/client/www/autotest.TkoClient/$1
-
-# These rules are fallbacks when autotest web client is installed along
-# the autotest server files, following the same layout as it is currently
-# in the source tree, that is, the "client" directory inside "frontent"
-RewriteCond 
/usr/lib/python2.7/site-packages/autotest/frontend/client/www/autotest.TkoClient
 -d
-RewriteRule /new_tko(.*) 
/usr/lib/python2.7/site-packages/autotest/frontend/client/www/autotest.TkoClient/$1
-
-RewriteCond 
/usr/lib/python2.6/site-packages/autotest/frontend/client/www/autotest.TkoClient
 -d
-RewriteRule /new_tko(.*) 
/usr/lib/python2.6/site-packages/autotest/frontend/client/www/autotest.TkoClient/$1
-
-RewriteCond 
/usr/lib/python2.5/site-packages/autotest/frontend/client/www/autotest.TkoClient
 -d
-RewriteRule /new_tko(.*) 
/usr/lib/python2.5/site-packages/autotest/frontend/client/www/autotest.TkoClient/$1
-
-RewriteCond 
/usr/lib/python2.4/site-packages/autotest/frontend/client/www/autotest.TkoClient
 -d
-RewriteRule /new_tko(.*) 
/usr/lib/python2.4/site-packages/autotest/frontend/client/www/autotest.TkoClient/$1
+RewriteRule /new_tko((?!\/server\/).*)$ 
/usr/share/autotest/frontend/client/www/autotest.TkoClient/$1
 
 <Location "/new_tko">
     DirectoryIndex TkoClient.html
+    <IfVersion >= 2.4>
+        Require all granted
+    </IfVersion>
 </Location>
diff --git a/apache/conf/site-directives b/apache/conf/site-directives
deleted file mode 100644
index e69de29..0000000
diff --git a/apache/conf/tko-directives b/apache/conf/tko-directives
index 1889692..3b252ca 100644
--- a/apache/conf/tko-directives
+++ b/apache/conf/tko-directives
@@ -10,10 +10,15 @@ RewriteCond /var/lib/autotest/results -d
 RewriteRule /results(.*) /var/lib/autotest/results/$1
 
 <Location "/results">
-    Options Indexes FollowSymLinks MultiViews
-    Order allow,deny
-    Allow from all
     IndexHeadInsert "<img src='/afe/header.png'/><hr/>"
+    Options +Indexes +FollowSymLinks +MultiViews
+    <IfVersion >= 2.4>
+        Require all granted
+    </IfVersion>
+    <IfVersion <= 2.2.99>
+        Order allow,deny
+        Allow from all
+    </IfVersion>
 </Location>
 
 <LocationMatch "/results.*\.(log|DEBUG|INFO|WARNING|ERROR)$">
@@ -40,8 +45,14 @@ RewriteCond /usr/lib/python2.4/site-packages/autotest/tko -d
 RewriteRule /tko(.*) /usr/lib/python2.4/site-packages/autotest/tko/$1
 
 <Location "/tko">
-    Options ExecCGI Indexes MultiViews +SymLinksIfOwnerMatch
+    Options +ExecCGI +Indexes +MultiViews +SymLinksIfOwnerMatch
     DirectoryIndex compose_query.cgi
-    Order allow,deny
-    Allow from all
+    <IfVersion >= 2.4>
+        Require all granted
+    </IfVersion>
+    # Non existing version, safeguard against new 2.2 releases
+    <IfVersion <= 2.2.99>
+        Order allow,deny
+        Allow from all
+    </IfVersion>
 </Location>
diff --git a/contrib/install-autotest-server.sh 
b/contrib/install-autotest-server.sh
index 0e64511..f1bc369 100755
--- a/contrib/install-autotest-server.sh
+++ b/contrib/install-autotest-server.sh
@@ -342,7 +342,10 @@ if [ ! -e  /etc/apache2/sites-enabled/001-autotest ]
 then
     /usr/local/bin/substitute "WSGISocketPrefix run/wsgi" "#WSGISocketPrefix 
run/wsgi" /usr/local/autotest/apache/conf/django-directives
     sudo rm /etc/apache2/sites-enabled/000-default
-    sudo ln -s /usr/local/autotest/apache/conf/apache-conf 
/etc/apache2/sites-enabled/001-autotest
+    sudo ln -s /etc/apache2/mods-available/version.load 
/etc/apache2/mods-enabled/
+    sudo ln -s /usr/local/autotest/apache/conf /etc/apache2/autotest.d
+    sudo ln -s /usr/local/autotest/apache/apache-conf 
/etc/apache2/sites-enabled/001-autotest
+    sudo ln -s /usr/local/autotest/apache/apache-web-conf 
/etc/apache2/sites-enabled/002-autotest
 fi
 a2enmod rewrite
 update-rc.d apache2 defaults
@@ -352,7 +355,11 @@ configure_webserver_rh() {
 print_log "INFO" "Configuring Web server"
 if [ ! -e  /etc/httpd/conf.d/autotest.conf ]
 then
-    ln -s /usr/local/autotest/apache/conf/all-directives 
/etc/httpd/conf.d/autotest.conf
+    # if for some reason, still running with mod_python, let it be parsed 
before the
+    # autotest config file, which has some directives to detect it
+    ln -s /usr/local/autotest/apache/conf /etc/httpd/autotest.d
+    ln -s /usr/local/autotest/apache/apache-conf 
/etc/httpd/conf.d/z_autotest.conf
+    ln -s /usr/local/autotest/apache/apache-web-conf 
/etc/httpd/conf.d/z_autotest-web.conf
 fi
 if [ -x /etc/init.d/httpd ]
 then
-- 
1.7.11.7

_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel

Reply via email to