This repository has been archived by the owner on Dec 31, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 94
/
appserver.apache2.passenger.conf.erb
181 lines (147 loc) · 6.13 KB
/
appserver.apache2.passenger.conf.erb
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<% unless @out[:port] == 80 %>
Listen <%= @out[:port] %>
<% end -%>
ServerTokens Prod
ServerSignature Off
Header always unset "X-Powered-By"
<VirtualHost *:<%= @out[:port] %>>
ServerName <%= node['hostname'] %>
ServerAlias <%= @application[:domains].join(" ") %>
<% if @application[:enable_ssl] && @out[:force_ssl] %>
<% if @out[:ssl_port].to_i == 443 %>
RewriteEngine On
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R=301,L]
<% else %>
RewriteEngine On
RewriteRule ^/?(.*) https://%{SERVER_NAME}:<%= @out[:ssl_port] %>/$1 [R=301,L]
<% end %>
<% else %>
# http support
DocumentRoot <%= File.join(@deploy_dir, 'current', 'public') %>
<Directory <%= File.join(@deploy_dir, 'current') %>>
Require all granted
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
LogLevel <%= @out[:log_level] %>
ErrorLog <%= @out[:log_dir] %>/<%= @application[:domains].first %>.error.log
CustomLog <%= @out[:log_dir] %>/<%= @application[:domains].first %>.access.log combined
FileETag none
LimitRequestBody <%= @out[:limit_request_body] || '1048576' %>
KeepAliveTimeout <%= @out[:keepalive_timeout] || '15' %>
<Location "/assets/">
ExpiresActive on
Header set Cache-Control "public"
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods "GET, PUT, POST, DELETE"
Header set Access-Control-Expose-Headers "ETag"
Header set X-Content-Type-Options "nosniff"
</Location>
<% if @appserver_config[:max_pool_size] -%>
PassengerMaxPoolSize <%= @appserver_config[:max_pool_size] %>
<% end %>
<% if @appserver_config[:min_instances] -%>
PassengerMinInstances <%= @appserver_config[:min_instances] %>
<% end %>
<% if @appserver_config[:pool_idle_time] -%>
PassengerPoolIdleTime <%= @appserver_config[:pool_idle_time] %>
<% end %>
<% if @appserver_config[:max_request_queue_size] -%>
PassengerMaxRequestQueueSize <%= @appserver_config[:max_request_queue_size] %>
<% end %>
<Location <%= @appserver_config[:mount_point] %>>
PassengerAppEnv <%= @deploy_env %>
PassengerBaseURI <%= @appserver_config[:mount_point] %>
PassengerAppRoot <%= File.join(@deploy_dir, 'current') %>
</Location>
RewriteEngine on
<% if @appserver_config[:error_document] -%>
PassengerErrorOverride on
<% @appserver_config[:error_document].each do | status, file | %>
ErrorDocument <%= status %> "/<%= file %>"
<% end %>
<% end %>
<% end %>
<%= @out[:extra_config] %>
</VirtualHost>
<% if @application[:enable_ssl] %>
<% unless @out[:ssl_port].to_i == 443 %>
Listen <%= @out[:ssl_port] %>
<% end -%>
SSLStaplingCache "shmcb:logs/stapling-cache(150000)"
<VirtualHost *:<%= @out[:ssl_port] %>>
ServerName <%= node['hostname'] %>
ServerAlias <%= @application[:domains].join(" ") %>
DocumentRoot <%= File.join(@deploy_dir, 'current', 'public') %>
<Directory <%= File.join(@deploy_dir, 'current') %>>
Require all granted
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
SSLEngine on
SSLProxyEngine on
SSLCertificateFile <%= @ssl_cert_dir %>/<%= @application[:domains].first %>.crt
SSLCertificateKeyFile <%= @ssl_cert_dir %>/<%= @application[:domains].first %>.key
<% if @application[:ssl_configuration][:chain] -%>
SSLCACertificateFile <%= @ssl_cert_dir %>/<%= @application[:domains].first %>.ca
<% end %>
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
<% if @out[:ssl_for_legacy_browsers] -%>
SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH:ECDHE-RSA-AES128-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA128:DHE-RSA-AES128-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES128-GCM-SHA128:ECDHE-RSA-AES128-SHA384:ECDHE-RSA-AES128-SHA128:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES128-SHA128:DHE-RSA-AES128-SHA128:DHE-RSA-AES128-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA384:AES128-GCM-SHA128:AES128-SHA128:AES128-SHA128:AES128-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4
SSLProtocol All -SSLv2 -SSLv3
<% else %>
SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH
SSLProtocol All -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
<% end %>
SSLHonorCipherOrder On
SSLCompression off
SSLUseStapling on
<% if @out[:dhparams].present? -%>
SSLOpenSSLConfCmd DHParameters "/etc/apache2/ssl/<%= @application[:domains].first %>.dhparams.pem"
<% end %>
LogLevel <%= @out[:log_level] %>
ErrorLog <%= @out[:log_dir] %>/<%= @application[:domains].first %>.error.log
CustomLog <%= @out[:log_dir] %>/<%= @application[:domains].first %>.access.log combined
FileETag none
LimitRequestBody <%= @out[:client_max_body_size] || '1048576' %>
KeepAliveTimeout <%= @out[:keepalive_timeout] || '15' %>
<Location "/assets/">
ExpiresActive on
Header set Cache-Control "public"
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods "GET, PUT, POST, DELETE"
Header set Access-Control-Expose-Headers "ETag"
Header set X-Content-Type-Options "nosniff"
</Location>
<% if @appserver_config[:max_pool_size] -%>
PassengerMaxPoolSize <%= @appserver_config[:max_pool_size] %>
<% end %>
<% if @appserver_config[:min_instances] -%>
PassengerMinInstances <%= @appserver_config[:min_instances] %>
<% end %>
<% if @appserver_config[:pool_idle_time] -%>
PassengerPoolIdleTime <%= @appserver_config[:pool_idle_time] %>
<% end %>
<% if @appserver_config[:max_request_queue_size] -%>
PassengerMaxRequestQueueSize <%= @appserver_config[:max_request_queue_size] %>
<% end %>
<Location <%= @appserver_config[:mount_point] %>>
PassengerAppEnv <%= @deploy_env %>
PassengerBaseURI <%= @appserver_config[:mount_point] %>
PassengerAppRoot <%= File.join(@deploy_dir, 'current') %>
</Location>
RequestHeader set X-Forwarded-Proto "https"
RewriteEngine on
<% if @appserver_config[:error_document] -%>
PassengerErrorOverride on
<% @appserver_config[:error_document].each do | status, file | %>
ErrorDocument <%= status %> "/<%= file %>"
<% end %>
<% end %>
<%= @out[:extra_config_ssl] %>
</VirtualHost>
<% end %>