Files
tco.koha/templates/apache-opac.conf
2022-06-23 14:12:50 +02:00

137 lines
4.6 KiB
Plaintext

# OPAC
<VirtualHost *:80>
ServerName {{ koha_opac_hostname }}
RedirectMatch permanent / https://{{ koha_opac_hostname }}
</virtualHost>
<VirtualHost *:443>
ServerAdmin webmaster@sciencespo-lyon.lan
DocumentRoot {{ koha_install_dir }}/opac/htdocs
ServerName {{ koha_opac_hostname }}
ServerAlias sv-{{ koha_opac_hostname }}
ServerAlias localhost
ErrorLog {{ koha_install_dir }}/var/log/koha-opac-error_log
CustomLog {{ koha_install_dir }}/var/log/koha-opac-access.log combined
SetEnv KOHA_CONF "{{ koha_install_dir }}/etc/koha-conf.xml"
SetEnv PERL5LIB "{{ koha_install_dir }}/lib"
SetEnv MEMCACHED_SERVERS "127.0.0.1:11221"
SetEnv MEMCACHED_NAMESPACE "KOHA"
Include /etc/koha/apache-shared-opac-plack.conf
<IfModule mod_ssl>
SSLEngine on
SSLProtocol all -SSLv2
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
SSLCertificateFile {{ koha_apache_ssl_cert }}
SSLCertificateKeyFile {{ koha_apache_ssl_key }}
SSLCertificateChainFile {{ koha_apache_ssl_chain }}
</IfModule>
<Directory "{{ koha_install_dir }}/opac/htdocs">
Options -Indexes
</Directory>
<Location />
require all granted
</Location>
ErrorDocument 400 /cgi-bin/koha/errors/400.pl
ErrorDocument 401 /cgi-bin/koha/errors/401.pl
ErrorDocument 403 /cgi-bin/koha/errors/403.pl
ErrorDocument 404 /cgi-bin/koha/errors/404.pl
ErrorDocument 500 /cgi-bin/koha/errors/500.pl
# Secure internal stuff
<DirectoryMatch "{{ koha_install_dir }}/opac/htdocs/.*/(modules|xslt|includes)">
Require all denied
</DirectoryMatch>
<IfModule mod_gzip.c>
mod_gzip_on yes
mod_gzip_dechunk yes
mod_gzip_keep_workfiles No
mod_gzip_can_negotiate yes
mod_gzip_update_static No
mod_gzip_temp_dir /tmp
mod_gzip_minimum_file_size 512
mod_gzip_maximum_file_size 1000000
mod_gzip_maximum_inmem_size 1000000
mod_gzip_handle_methods GET POST
mod_gzip_item_exclude reqheader "User-Agent: .*Mozilla/4\..*\["
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader Content-Type:image/*
mod_gzip_item_include file \.js$
mod_gzip_item_include mime ^application/javascript$
mod_gzip_item_include mime ^application/x-javascript$
mod_gzip_item_include file \.php$
mod_gzip_item_include mime ^text/html$
mod_gzip_item_include file \.css$
mod_gzip_item_include mime ^text/css$
</IfModule>
<IfModule mod_deflate.c>
# Compress content with type html, text, and css, ...
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css
AddOutputFilterByType DEFLATE application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript
DeflateCompressionLevel 9
# Properly handle old browsers that do not support compression
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
DeflateFilterNote Input instream
DeflateFilterNote Output outstream
DeflateFilterNote Ratio ratio
LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
<IfModule mod_headers.c>
#properly handle requests coming from behind proxies
Header append Vary User-Agent
</IfModule>
</IfModule>
Options +FollowSymLinks
ErrorDocument 400 /cgi-bin/koha/errors/400.pl
ErrorDocument 401 /cgi-bin/koha/errors/401.pl
ErrorDocument 403 /cgi-bin/koha/errors/403.pl
ErrorDocument 404 /cgi-bin/koha/errors/404.pl
ErrorDocument 500 /cgi-bin/koha/errors/500.pl
Include /etc/koha/apache-shared-api-acl.conf
<IfModule mod_rewrite.c>
# Rewrite Rules
RewriteEngine On
#The following two directives are unnecessary to proper Koha functioning.
RewriteCond %{QUERY_STRING} (.*?)(?:[A-Za-z0-9_-]+)=&(.*)
RewriteRule (.+) $1?%1%2 [N,R,NE]
RewriteRule ^/bib/([^\/]*)/?$ /cgi-bin/koha/opac-detail\.pl?bib=$1 [PT]
RewriteRule ^/isbn/([^\/]*)/?$ /search?q=isbn:$1 [PT]
RewriteRule ^/issn/([^\/]*)/?$ /search?q=issn:$1 [PT]
RewriteRule ^(.*)_[0-9]{2}\.[0-9]{7}\.(js|css)$ $1.$2 [L]
# REST API configuration
Alias "/api" "{{ koha_install_dir }}/api"
<Directory {{ koha_install_dir }}/api>
Options +ExecCGI +FollowSymlinks
AddHandler cgi-script .pl
SetEnv MOJO_MODE "production"
RewriteEngine On
RewriteBase /api/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/../api/$1/app.pl -f
RewriteRule ^(.*?)/.* $1/app.pl/api/$0 [L]
</Directory>
</IfModule>
</VirtualHost>