summaryrefslogtreecommitdiff
path: root/templates/site.erb
blob: 9e5763f8166abdbb84bbd7acdcddad3966fecd7a (plain)
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
# begin vhost for <%= title %>
<VirtualHost <%= listen %>:80>
   ServerName <%= title %>.<%= hosting_domain %>
<% if server_alias != false %>   ServerAlias <%= server_alias %><% end %>
   DocumentRoot <%= docroot %>
<% if https_redirect != false or canonical != false %>
   RewriteEngine On
<% end -%>
<% if https_redirect != false %>
   # Use HTTP Strict Transport Security to force client to use secure connections only
   Header always set Strict-Transport-Security "max-age=15768000; includeSubDomains"

   # Redirect all HTTP to HTTPS
   RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [redirect=301]<% end %>
<% if redirect_match != false %>   RedirectMatch ^/$ <%= protocol %>://<%= title %>.<%= hosting_domain %>/<%= redirect_match %><% end %>
<% if redirect != false %>   Redirect <%= redirect %><% end %>
<% if aliases != false %><% aliases.each do |map| -%>
   Alias <%= map %>
<% end -%><% end -%>  
<% if use != false %><% use.each do |instance| -%>
   Use <%= instance %>
<% end -%><% end -%>
<% if mpm == true %>
   <IfModule mpm_itk_module>
     AssignUserId <%= user %> <%= gid %>
   </IfModule>
<% end %>   
<% if canonical != false %>
   <%- for canonical_exception in canonical_exceptions -%>
   RewriteCond %{HTTP_HOST}   !=<%= canonical_exception %> [NC]
   <%- end -%>
   RewriteCond %{HTTP_HOST}   !=<%= canonical %> [NC]
   RewriteCond %{HTTP_HOST}   !=""
   RewriteRule ^/(.*)         <%= protocol %>://<%= canonical %>/$1 [L,R=301]
<% end %>
<% if custom_directives != false -%>
   <%= custom_directives %>
<% end -%>
</VirtualHost>
# end vhost for <%= title %>
<% if ssl == true %>
# begin ssl vhost for <%= title %>
<VirtualHost <%= listen %>:443>
   ServerName <%= title %>.<%= hosting_domain %>
<% if server_alias != false %>   ServerAlias <%= server_alias %><% end %>
   DocumentRoot <%= docroot %>
<% if redirect_match != false %>   RedirectMatch ^/$ <%= protocol %>://<%= title %>.<%= hosting_domain %>/<%= redirect_match %><% end %>
<% if redirect != false %>   Redirect <%= redirect %><% end %>
<% if aliases != false %><% aliases.each do |map| -%>
   Alias <%= map %>
<% end -%><% end -%>  
<% if use != false %><% use.each do |instance| -%>
   Use <%= instance %>
<% end -%><% end -%>
<% if custom_directives != false -%>
  <%= custom_directives %>
<% end -%>
<% if mpm == true %>
   <IfModule mpm_itk_module>
     AssignUserId <%= user %> <%= gid %>
   </IfModule>
<% end %>
   # SSL Configuration
   SSLEngine on
   SSLProtocol -all +SSLv3 +TLSv1
   SSLCipherSuite HIGH:MEDIUM:!aNULL:!SSLv2:!MD5:@STRENGTH
   SSLHonorCipherOrder on
   SSLCertificateFile    /etc/ssl/certs/<%= title %>.crt
   SSLCertificateKeyFile /etc/ssl/private/<%= title %>.pem
</VirtualHost>
# end ssl vhost for <%= title %>
<% end %>