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