default.rb
6.47 KB
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
#
# Author:: Earth U (<sysadmin@chromedia.com>)
# Cookbook Name:: cfe-nginx-php-fpm
# Attribute:: default
#
# Copyright 2016, Chromedia Far East, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# The socket used PHP-FPM. If false, fastcgi is not used.
# Examples:
# '127.0.0.1:9000'
# '/var/run/php-fpm.sock'
# false
default['cfe-nginx-php-fpm']['php_fastcgi_socket'] = '127.0.0.1:9000'
# Setting 'update_cacert' to true will get the latest cacert from
# http://curl.haxx.se/ca/cacert.pem and use that as CAFile for postfix.
default['cfe-nginx-php-fpm']['postfix']['update_cacert'] = true
default['cfe-nginx-php-fpm']['postfix']['email_domain'] = 'example.com'
# If your php-fpm pool is not named 'www', then delete
# the default one 'www' automatically installed by php-fpm
default['cfe-nginx-php-fpm']['php-fpm']['delete_pool_www'] = true
default['cfe-nginx-php-fpm']['nginx']['inc_dir'] =
"#{node['nginx']['dir']}/sites-available/include"
default['cfe-nginx-php-fpm']['nginx']['priv_dir'] =
"#{node['nginx']['dir']}/private"
default['cfe-nginx-php-fpm']['nginx']['restriction_file']['log_robots'] = false
default['cfe-nginx-php-fpm']['nginx']['restriction_file']['log_hidden'] = true
default['cfe-nginx-php-fpm']['nginx']['restriction_file']['log_static'] = false
default['cfe-nginx-php-fpm']['nginx']['restriction_file']['static_types'] = %w{
js css ogg ogv svg svgz eot otf woff mp4 ttf rss atom
jpg jpeg gif png ico zip tgz gz rar bz2
doc xls exe ppt tar mid midi wav bmp rtf
}
default['cfe-nginx-php-fpm']['nginx']['sites'] = [
{
:server_name => 'example.com',
:aliases => ['www.example.com'],
:doc_root => '/var/www/example.com',
:index => 'index.php',
# Access log options as one long string. Default: false
#:access_log_options => '<some options>'
# Whether to include a default virtual server named '_' or not.
# If there is more than one server given in this 'sites' array,
# 'catch_all' value will always be overriden to 'false'.
# Default: true
#:catch_all => true
# Necessary values for SSL/TLS setup. Default: :ssl => false
#:ssl => {
# :cert => '[contents of chain cert here]',
# :key => '[contents of cert private key here]',
# :dh_modulus => 2048,
# :self_signed => false,
# :hsts_max_age => '15758000',
# :hsts_include_subdomains => true
#}
# Necessary values for Basic Auth setup. Default: :auth => false
#:auth => {
# :msg => 'Restricted Area. Please authenticate.',
# :users => {
# 'example_user' => 'secretpassword123'
# }
#}
# An array of strings that will be included as statements in the main
# nginx config file for this server. Default: []
#:custom_statements => []
# Enumerates the different site types this server supports.
# Possible elements of :types are (only :type is mandatory):
# {
# :type => 'basic',
# :subpath => ''
# }
# {
# :type => 'wordpress',
# :subpath => '',
# :fastcgi_intercept_errors => false,
# :loginpage_statements => [] # An array of strings to be
# # written on the config for the
# # /wp-login.php and /wp-admin pages.
# }
:types => [ { :type => 'basic' } ]
}
]
#
# php-fpm cookbook
#
default['php-fpm']['user'] = node['nginx']['user']
default['php-fpm']['group'] = node['nginx']['group']
default['php-fpm']['skip_repository_install'] = true
default['php-fpm']['pools'] = [
# Most likely, just use one pool for all PHP needs.
# (But there are exceptions, of course)
{
:name => 'example_pool',
:enable => true,
:listen => node['cfe-nginx-php-fpm']['php_fastcgi_socket'],
:user => node['nginx']['user'],
:group => node['nginx']['group'],
:max_requests => 500,
:max_children => 50,
:access_log => false,
:catch_workers_output => 'no',
#:access_log => true,
#:catch_workers_output => 'yes',
:process_manager => value_for_platform(
'ubuntu' => {
'10.04' => 'dynamic'
},
'default' => 'ondemand'
),
# Only used if process_manager is 'dynamic':
:start_servers => 5,
:min_spare_servers => 5,
:max_spare_servers => 35,
:php_options => {
'php_admin_value[cgi.fix_pathinfo]' => '0',
'php_admin_value[expose_php]' => 'Off',
'php_value[upload_max_filesize]' => '5M',
'php_value[post_max_size]' => '10M'
}
}
]
#
# mariadb cookbook
#
default['mariadb']['install']['type'] = 'package'
default['mariadb']['install']['version'] = '5.5'
#
# postfix cookbook
#
default['postfix']['main']['myorigin'] = '$mydomain'
default['postfix']['main']['myhostname'] =
node['cfe-nginx-php-fpm']['postfix']['email_domain']
default['postfix']['main']['mydomain'] =
node['cfe-nginx-php-fpm']['postfix']['email_domain']
default['postfix']['main']['mydestination'] =
['localhost.localdomain', 'localhost']
#
# nginx cookbook
#
default['nginx']['version'] = '1.9.14'
default['nginx']['install_method'] = 'package'
default['nginx']['package_name'] = 'nginx'
default['nginx']['repo_source'] = 'nginx'
default['nginx']['upstream_repository'] =
'http://nginx.org/packages/mainline/ubuntu'
# Set pid file initially in accordance with Ubuntu 14.04
# nginx package's pid file. Otherwise, it fails to restart.
default['nginx']['pid'] = '/var/run/nginx.pid'
default['nginx']['default_site_enabled'] = false
default['nginx']['client_max_body_size'] = '10m'
default['nginx']['event'] = 'epoll'
default['nginx']['worker_processes'] = 'auto'
default['nginx']['worker_connections'] = 1_024
default['nginx']['keepalive_timeout'] = 15
default['nginx']['keepalive_requests'] = 200
default['nginx']['disable_access_log'] = false
default['nginx']['server_tokens'] = 'off'
default['nginx']['gzip_comp_level'] = '5'
default['nginx']['extra_configs'] = {
'reset_timedout_connection' => 'on'
}