]> git.openstreetmap.org Git - chef.git/blob - cookbooks/otrs/templates/default/apache-debian.erb
otrs: Add otrs::debian for installing otrs via deb package
[chef.git] / cookbooks / otrs / templates / default / apache-debian.erb
1 # DO NOT EDIT - This file is being maintained by Chef
2
3 <VirtualHost *:80>
4   ServerName <%= @name %>
5 <% @aliases.each do |alias_name| -%>
6   ServerAlias <%= alias_name %>
7 <% end -%>
8   ServerAdmin webmaster@openstreetmap.org
9
10   CustomLog /var/log/apache2/<%= @name %>-access.log combined_extended
11   ErrorLog /var/log/apache2/<%= @name %>-error.log
12
13   RedirectPermanent /.well-known/acme-challenge/ http://acme.openstreetmap.org/.well-known/acme-challenge/
14   RedirectPermanent / https://<%= @name %>/
15 </VirtualHost>
16 <% unless @aliases.empty? -%>
17
18 <VirtualHost *:443>
19   ServerName <%= @aliases.first %>
20 <% @aliases.drop(1).each do |alias_name| -%>
21   ServerAlias <%= alias_name %>
22 <% end -%>
23   ServerAdmin webmaster@openstreetmap.org
24
25   SSLEngine on
26   SSLCertificateFile /etc/ssl/certs/<%= @name %>.pem
27   SSLCertificateKeyFile /etc/ssl/private/<%= @name %>.key
28
29   CustomLog /var/log/apache2/<%= @name %>-access.log combined_extended
30   ErrorLog /var/log/apache2/<%= @name %>-error.log
31
32   RedirectPermanent / https://<%= @name %>/
33 </VirtualHost>
34 <% end -%>
35
36 <VirtualHost *:443>
37   ServerName <%= @name %>
38   ServerAdmin webmaster@openstreetmap.org
39
40   CustomLog /var/log/apache2/<%= @name %>-access.log combined_extended
41   ErrorLog /var/log/apache2/<%= @name %>-error.log
42
43   SSLEngine on
44   SSLCertificateFile /etc/ssl/certs/<%= @name %>.pem
45   SSLCertificateKeyFile /etc/ssl/private/<%= @name %>.key
46
47   ScriptAlias /otrs "/usr/share/otrs/bin/cgi-bin/"
48   Alias /otrs-web "/usr/share/otrs/var/httpd/htdocs/"
49   RedirectMatch ^/$ /otrs/index.pl
50
51   Perlrequire /usr/share/otrs/scripts/apache2-perl-startup.pl
52
53   PerlModule Apache2::Reload
54   PerlInitHandler Apache2::Reload
55
56
57   <Location /otrs>
58     ErrorDocument 403 /otrs/index.pl
59                 ErrorDocument 404 /otrs/index.pl
60     SetHandler  perl-script
61     PerlResponseHandler ModPerl::Registry
62     Options +ExecCGI
63     PerlOptions +ParseHeaders
64     PerlOptions +SetupEnv
65     Require all granted
66   </Location>
67
68   <Location /otrs/nph-genericinterface.pl>
69     PerlOptions -ParseHeaders
70   </Location>
71 </VirtualHost>
72
73 <Directory "/usr/share/otrs/bin/cgi-bin/">
74     AllowOverride None
75     Options +ExecCGI -Includes
76     Require all granted
77 </Directory>
78
79 <Directory "/usr/share/otrs/var/httpd/htdocs/">
80   AllowOverride None
81   Require all granted
82
83   # Make sure CSS and JS files are read as UTF8 by the browsers.
84   AddCharset UTF-8 .css
85   AddCharset UTF-8 .js
86
87   # Set explicit mime type for woff fonts since it is relatively new and apache may not know about it.
88   AddType application/font-woff .woff
89 </Directory>
90
91 # Cache css-cache for 30 days
92 <Directory "/usr/share/otrs/var/httpd/htdocs/skins/*/*/css-cache">
93     <FilesMatch "\.(css|CSS)$">
94         Header set Cache-Control "max-age=2592000, must-revalidate"
95     </FilesMatch>
96 </Directory>
97
98 <Directory "/usr/share/otrs/var/httpd/htdocs/skins/*/*/css/thirdparty">
99     <FilesMatch "\.(css|CSS|woff|svg)$">
100         Header set Cache-Control "max-age=14400, must-revalidate"
101     </FilesMatch>
102 </Directory>
103
104 <Directory "/usr/share/otrs/var/httpd/htdocs/js/js-cache">
105     <FilesMatch "\.(js|JS)$">
106         Header set Cache-Control "max-age=2592000, must-revalidate"
107     </FilesMatch>
108 </Directory>
109
110 <Directory "/usr/share/otrs/var/httpd/htdocs/js/thirdparty/">
111     <FilesMatch "\.(js|JS)$">
112         Header set Cache-Control "max-age=14400, must-revalidate"
113     </FilesMatch>
114 </Directory>