-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdocserv-rwmap.conf
86 lines (70 loc) · 2.79 KB
/
docserv-rwmap.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#
# docserv VirtualHost config
#
# Install in /etc/apache2/vhosts.d/
#
# See /usr/share/doc/packages/apache2/README.QUICKSTART for further hints
# about virtual hosts.
#
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName docserv.localhost
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
DocumentRoot /srv/docserv
# if not specified, the global error log is used
ErrorLog /var/log/apache2/error_log
CustomLog /var/log/apache2/access_log combined
# don't loose time with IP address lookups
HostnameLookups Off
# needed for named virtual hosts
UseCanonicalName Off
# Add gzip to the Accept-Encoding to prevent apache from serving an
# HTTP 406 Not Acceptable response. We keep the original
# Accept-Encoding value and later on use mod_deflate to uncompress if
# necessary.
RequestHeader set Accept-Encoding "expr=gzip,%{req:Accept-Encoding}" early
ExpiresActive On
ExpiresDefault "access plus 1 hours"
<Files ~ "^rwmap">
Require all denied
</Files>
#<Location /auxserver/>
# ProxyPass "http://localhost:2431/"
# ProxyPassReverse "http://localhost:2431/"
#</Location>
#ErrorDocument 404 /auxserver/%{REQUEST_URI}?%{QUERY_STRING}
RewriteEngine On
RewriteMap redirectmap "txt:/srv/docserv/rwmap.txt"
#LogLevel alert rewrite:trace6
RewriteCond "^/jump"
RewriteCond %{QUERY_STRING} q=(.*)
RewriteRule ^/jump ${redirectmap:/%1}? [R=302,QSD,L]
RewriteCond "^/jump"
RewriteCond %{QUERY_STRING} suite=(.*)&binarypkg=(.*)§ion=(.*)&language=(.*)&q=(.*)
RewriteRule ^/jump ${redirectmap:/%5}? [R=302,QSD,L]
# We ignore the other informations as we cannot check which of them
# are valid and which not...
#RewriteRule ^/jump /%1/%2/%5.%3.%4.html
# If requested resource exists as a file or directory go to it
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME}.gz !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME}.gz !-d
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteRule (.*) ${redirectmap:/%1}? [L]
<Directory /srv/docserv>
Require all granted
# To set the correct Content-Type (e.g. text/html).
RemoveType .gz
AddEncoding gzip gz
FilterDeclare gzip CONTENT_SET
FilterProvider gzip inflate "%{req:Accept-Encoding} !~ /gzip,.*gzip/"
FilterChain gzip
Options +Multiviews
</Directory>
</VirtualHost>