Merge branch 'bug_7368' into 3.12-master
[koha.git] / etc / koha-httpd.conf
1 # Koha Apache Configuration Directives
2
3 #NameVirtualHost *
4
5 ## OPAC
6 <VirtualHost __WEBSERVER_IP__:__WEBSERVER_PORT__>
7    ServerAdmin  __WEBMASTER_EMAIL__
8    DocumentRoot __OPAC_WWW_DIR__
9    ServerName __WEBSERVER_HOST__
10 #  ServerAlias opac.mydomain.com
11    ScriptAlias /cgi-bin/koha/ "__OPAC_CGI_DIR__/opac/"
12    ScriptAlias /index.html "__OPAC_CGI_DIR__/opac/opac-main.pl"
13    ScriptAlias /opac-search.pl "__OPAC_CGI_DIR__/opac/opac-search.pl"
14    ScriptAlias /search "__OPAC_CGI_DIR__/opac/opac-search.pl"
15    ErrorLog __LOG_DIR__/koha-opac-error_log
16 #  CustomLog __LOG_DIR__/koha-opac-access.log combined
17 #  TransferLog __LOG_DIR__/koha-opac-access.log
18    SetEnv KOHA_CONF "__KOHA_CONF_DIR__/koha-conf.xml"
19    SetEnv PERL5LIB "__PERL_MODULE_DIR__"
20    SetEnv MEMCACHED_SERVERS "__MEMCACHED_SERVERS__"
21    SetEnv MEMCACHED_NAMESPACE "__MEMCACHED_NAMESPACE__"
22
23    <IfModule mod_gzip.c>
24      mod_gzip_on yes
25      mod_gzip_dechunk yes
26      mod_gzip_keep_workfiles No
27      mod_gzip_can_negotiate yes
28      mod_gzip_update_static No
29      mod_gzip_temp_dir /tmp
30      mod_gzip_minimum_file_size 512
31      mod_gzip_maximum_file_size 1000000
32      mod_gzip_maximum_inmem_size 1000000
33      mod_gzip_handle_methods GET POST
34      mod_gzip_item_exclude reqheader "User-Agent: .*Mozilla/4\..*\["
35      mod_gzip_item_exclude mime ^image/.*
36      mod_gzip_item_exclude rspheader Content-Type:image/*
37      mod_gzip_item_include file \.js$
38      mod_gzip_item_include mime ^application/javascript$
39      mod_gzip_item_include mime ^application/x-javascript$
40      mod_gzip_item_include file \.php$
41      mod_gzip_item_include mime ^text/html$
42      mod_gzip_item_include file \.css$
43      mod_gzip_item_include mime ^text/css$
44   </IfModule>
45
46   <IfModule mod_deflate.c>
47
48     # Compress content with type html, text, and css, ...
49     AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css
50     AddOutputFilterByType DEFLATE application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript
51
52     DeflateCompressionLevel 9
53
54     # Properly handle old browsers that do not support compression
55     BrowserMatch ^Mozilla/4 gzip-only-text/html
56     BrowserMatch ^Mozilla/4\.0[678] no-gzip
57     BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
58
59     DeflateFilterNote Input instream
60     DeflateFilterNote Output outstream
61     DeflateFilterNote Ratio ratio
62
63     LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
64     <IfModule mod_headers.c>
65        #properly handle requests coming from behind proxies
66        Header append Vary User-Agent
67     </IfModule>
68   </IfModule>
69
70
71 #  Repeat this virtualhost stanza changing the following environment vars to
72 #  create multiple OPAC interfaces with custom css and/or search limits:
73 #  SetEnv OPAC_CSS_OVERRIDE mystyle.css
74 #  SetEnv OPAC_SEARCH_LIMIT branch:CODE
75 #  SetEnv OPAC_LIMIT_OVERRIDE 1
76
77    Options +FollowSymLinks
78
79    ErrorDocument 400 /cgi-bin/koha/errors/400.pl
80    ErrorDocument 401 /cgi-bin/koha/errors/401.pl
81    ErrorDocument 403 /cgi-bin/koha/errors/403.pl
82    ErrorDocument 404 /cgi-bin/koha/errors/404.pl
83    ErrorDocument 500 /cgi-bin/koha/errors/500.pl
84
85 #  Rewrite Rules
86    RewriteEngine On
87
88 #  Uncomment to turn on rewrite logging
89 #  RewriteLog __LOG_DIR__/koha-opac-rewrite.log
90 #  RewriteLogLevel 1
91    RewriteCond %{QUERY_STRING} (.*?)(?:[A-Za-z0-9_-]+)=&(.*)
92    RewriteRule (.+) $1?%1%2 [N,R,NE]
93
94    RewriteRule ^/bib/([^\/]*)/?$ /cgi-bin/koha/opac-detail\.pl?bib=$1 [PT]
95    RewriteRule ^/isbn/([^\/]*)/?$ /search?q=isbn:$1 [PT]
96    RewriteRule ^/issn/([^\/]*)/?$ /search?q=issn:$1 [PT]
97 </VirtualHost>
98
99 ## Intranet
100 <VirtualHost __WEBSERVER_IP__:__WEBSERVER_PORT_LIBRARIAN__>
101    ServerAdmin __WEBMASTER_EMAIL__
102    DocumentRoot __INTRANET_WWW_DIR__
103    ServerName __WEBSERVER_HOST__:__WEBSERVER_PORT_LIBRARIAN__
104 #  ServerAlias intranet.mydomain.com
105    ScriptAlias /cgi-bin/koha/ "__INTRANET_CGI_DIR__/"
106    ScriptAlias /index.html "__INTRANET_CGI_DIR__/mainpage.pl"
107    ScriptAlias /search "__INTRANET_CGI_DIR__/search.pl"
108    ErrorLog __LOG_DIR__/koha-error_log
109 #  TransferLog __LOG_DIR__/koha-access.log
110    SetEnv KOHA_CONF "__KOHA_CONF_DIR__/koha-conf.xml"
111    SetEnv PERL5LIB "__PERL_MODULE_DIR__"
112    SetEnv MEMCACHED_SERVERS "__MEMCACHED_SERVERS__"
113    SetEnv MEMCACHED_NAMESPACE "__MEMCACHED_NAMESPACE__"
114    Options +FollowSymLinks
115
116    ErrorDocument 400 /cgi-bin/koha/errors/400.pl
117    ErrorDocument 401 /cgi-bin/koha/errors/401.pl
118    ErrorDocument 403 /cgi-bin/koha/errors/403.pl
119    ErrorDocument 404 /cgi-bin/koha/errors/404.pl
120    ErrorDocument 500 /cgi-bin/koha/errors/500.pl
121
122    <IfModule mod_gzip.c>
123      mod_gzip_on yes
124      mod_gzip_dechunk yes
125      mod_gzip_keep_workfiles No
126      mod_gzip_can_negotiate yes
127      mod_gzip_update_static No
128      mod_gzip_temp_dir /tmp
129      mod_gzip_minimum_file_size 512
130      mod_gzip_maximum_file_size 1000000
131      mod_gzip_maximum_inmem_size 1000000
132      mod_gzip_handle_methods GET POST
133      mod_gzip_item_exclude reqheader "User-Agent: .*Mozilla/4\..*\["
134      mod_gzip_item_exclude mime ^image/.*
135      mod_gzip_item_exclude rspheader Content-Type:image/*
136      mod_gzip_item_include file \.js$
137      mod_gzip_item_include mime ^application/javascript$
138      mod_gzip_item_include mime ^application/x-javascript$
139      mod_gzip_item_include file \.php$
140      mod_gzip_item_include mime ^text/html$
141      mod_gzip_item_include file \.css$
142      mod_gzip_item_include mime ^text/css$
143    </IfModule>
144
145    <IfModule mod_deflate.c>
146
147      # Compress content with type html, text, and css, ...
148      AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css
149      AddOutputFilterByType DEFLATE application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript
150
151      DeflateCompressionLevel 9
152
153      # Properly handle old browsers that do not support compression
154      BrowserMatch ^Mozilla/4 gzip-only-text/html
155      BrowserMatch ^Mozilla/4\.0[678] no-gzip
156      BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
157
158      DeflateFilterNote Input instream
159      DeflateFilterNote Output outstream
160      DeflateFilterNote Ratio ratio
161
162      LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
163      <IfModule mod_headers.c>
164        #properly handle requests coming from behind proxies
165        Header append Vary User-Agent
166      </IfModule>
167   </IfModule>
168
169    RewriteEngine On    
170 #  Uncomment to turn on rewrite logging
171 #  RewriteLog __LOG_DIR__/koha-intranet-rewrite.log
172 #  RewriteLogLevel 1
173
174    RewriteCond %{QUERY_STRING} (.*?)(?:[A-Za-z0-9_-]+)=&(.*)
175    RewriteRule (.+) $1?%1%2 [N,R,NE]
176    RewriteRule ^/bib/([^\/]*)/?$ /cgi-bin/koha/detail\.pl?bib=$1 [PT]
177    RewriteRule ^/isbn/([^\/]*)/?$ /search?q=isbn:$1 [PT]
178    RewriteRule ^/issn/([^\/]*)/?$ /search?q=issn:$1 [PT]
179 </VirtualHost>