View difference between Paste ID: L0p1wC6c and wSZyZ3TE
SHOW: | | - or go back to the newest paste.
1
Nginx Configuration:
2
3
user www-data;
4
worker_processes 4;
5
pid /run/nginx.pid;
6
7
events {
8
	worker_connections 768;
9
	# multi_accept on;
10
}
11
12
http {
13
14
	##
15
	# Basic Settings
16
	##
17
18
	sendfile on;
19
	tcp_nopush on;
20
	tcp_nodelay on;
21
	keepalive_timeout 65;
22
	types_hash_max_size 2048;
23
	 server_tokens off;
24
25
	# server_names_hash_bucket_size 64;
26
	# server_name_in_redirect off;
27
28
	include /etc/nginx/mime.types;
29
	default_type application/octet-stream;
30
31
	##
32
	# Logging Settings
33
	##
34
35
	access_log /var/log/nginx/access.log;
36
	error_log /var/log/nginx/error.log;
37
38
	##
39
	# Gzip Settings
40
	##
41
42
	gzip on;
43
	gzip_disable "msie6";
44
45
	# gzip_vary on;
46
	# gzip_proxied any;
47
	# gzip_comp_level 6;
48
	# gzip_buffers 16 8k;
49
	# gzip_http_version 1.1;
50
	# gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
51
52
	##
53
	# nginx-naxsi config
54
	##
55
	# Uncomment it if you installed nginx-naxsi
56
	##
57
58
	#include /etc/nginx/naxsi_core.rules;
59
60
	##
61
	# nginx-passenger config
62
	##
63
	# Uncomment it if you installed nginx-passenger
64
	##
65
	
66
	#passenger_root /usr;
67
	#passenger_ruby /usr/bin/ruby;
68
69
	##
70
	# Virtual Host Configs
71
	##
72
73
	include /etc/nginx/conf.d/*.conf;
74
	include /etc/nginx/sites-enabled/*;
75
}
76
77
78
#mail {
79
#	# See sample authentication script at:
80
#	# http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
81
# 
82
#	# auth_http localhost/auth.php;
83
#	# pop3_capabilities "TOP" "USER";
84
#	# imap_capabilities "IMAP4rev1" "UIDPLUS";
85
# 
86
#	server {
87
#		listen     localhost:110;
88
#		protocol   pop3;
89
#		proxy      on;
90
#	}
91
# 
92
#	server {
93
#		listen     localhost:143;
94
#		protocol   imap;
95
#		proxy      on;
96
#	}
97
#}
98
99
100
Php5-fpm conf as stored in /etc/php5/fpm/main.conf
101
;;;;;;;;;;;;;;;;;;;;;
102
; FPM Configuration ;
103
;;;;;;;;;;;;;;;;;;;;;
104
105
; All relative paths in this configuration file are relative to PHP's install
106
; prefix (/usr). This prefix can be dynamicaly changed by using the
107
; '-p' argument from the command line.
108
109
; Include one or more files. If glob(3) exists, it is used to include a bunch of
110
; files from a glob(3) pattern. This directive can be used everywhere in the
111
; file.
112
; Relative path can also be used. They will be prefixed by:
113
;  - the global prefix if it's been set (-p arguement)
114
;  - /usr otherwise
115
;include=/etc/php5/fpm/*.conf
116
117
;;;;;;;;;;;;;;;;;;
118
; Global Options ;
119
;;;;;;;;;;;;;;;;;;
120
121
[global]
122
; Pid file
123
; Note: the default prefix is /var
124
; Default Value: none
125
pid = /var/run/php5-fpm.pid
126
127
; Error log file
128
; Note: the default prefix is /var
129
; Default Value: log/php-fpm.log
130
error_log = /var/log/php5-fpm.log
131
132
; Log level
133
; Possible Values: alert, error, warning, notice, debug
134
; Default Value: notice
135
;log_level = notice
136
137
; If this number of child processes exit with SIGSEGV or SIGBUS within the time
138
; interval set by emergency_restart_interval then FPM will restart. A value
139
; of '0' means 'Off'.
140
; Default Value: 0
141
;emergency_restart_threshold = 0
142
143
; Interval of time used by emergency_restart_interval to determine when 
144
; a graceful restart will be initiated.  This can be useful to work around
145
; accidental corruptions in an accelerator's shared memory.
146
; Available Units: s(econds), m(inutes), h(ours), or d(ays)
147
; Default Unit: seconds
148
; Default Value: 0
149
;emergency_restart_interval = 0
150
151
; Time limit for child processes to wait for a reaction on signals from master.
152
; Available units: s(econds), m(inutes), h(ours), or d(ays)
153
; Default Unit: seconds
154
; Default Value: 0
155
;process_control_timeout = 0
156
157
; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging.
158
; Default Value: yes
159
;daemonize = yes
160
161
;;;;;;;;;;;;;;;;;;;;
162
; Pool Definitions ; 
163
;;;;;;;;;;;;;;;;;;;;
164
165
; Multiple pools of child processes may be started with different listening
166
; ports and different management options.  The name of the pool will be
167
; used in logs and stats. There is no limitation on the number of pools which
168
; FPM can handle. Your system will tell you anyway :)
169
170
; To configure the pools it is recommended to have one .conf file per
171
; pool in the following directory:
172
include=/etc/php5/fpm/pool.d/*.conf
173
174
Ram Usage at top
175
176
 Private  +   Shared  =  RAM used       Program 
177
178
188.0 KiB +  30.0 KiB = 218.0 KiB       syslogd
179
284.0 KiB +  45.0 KiB = 329.0 KiB       cron
180
296.0 KiB +  45.0 KiB = 341.0 KiB       xinetd
181
372.0 KiB + 228.5 KiB = 600.5 KiB       pickup
182
400.0 KiB + 211.5 KiB = 611.5 KiB       master
183
472.0 KiB + 232.5 KiB = 704.5 KiB       qmgr
184
712.0 KiB +  58.5 KiB = 770.5 KiB       init
185
  1.1 MiB +  41.0 KiB =   1.1 MiB       bash
186
  1.4 MiB + 851.0 KiB =   2.2 MiB       sshd (2)
187
  2.4 MiB +   1.1 MiB =   3.4 MiB       nginx (5)
188
 11.5 MiB + 122.5 KiB =  11.6 MiB       named
189
 18.3 MiB +  81.5 KiB =  18.4 MiB       mysqld
190
244.2 MiB +  83.4 MiB = 327.6 MiB       php5-fpm (21)
191
---------------------------------
192-
                        367.9 MiB
192+
                        367.9 MiB
193
194
195
www.conf in pool.d dir
196
197
198
; Start a new pool named 'www'.
199
; the variable $pool can we used in any directive and will be replaced by the
200
; pool name ('www' here)
201
[www]
202
203
; Per pool prefix
204
; It only applies on the following directives:
205
; - 'slowlog'
206
; - 'listen' (unixsocket)
207
; - 'chroot'
208
; - 'chdir'
209
; - 'php_values'
210
; - 'php_admin_values'
211
; When not set, the global prefix (or /usr) applies instead.
212
; Note: This directive can also be relative to the global prefix.
213
; Default Value: none
214
;prefix = /path/to/pools/$pool
215
216
; The address on which to accept FastCGI requests.
217
; Valid syntaxes are:
218
;   'ip.add.re.ss:port'    - to listen on a TCP socket to a specific address on
219
;                            a specific port;
220
;   'port'                 - to listen on a TCP socket to all addresses on a
221
;                            specific port;
222
;   '/path/to/unix/socket' - to listen on a unix socket.
223
; Note: This value is mandatory.
224
listen = 127.0.0.1:9000
225
226
; Set listen(2) backlog. A value of '-1' means unlimited.
227
; Default Value: 128 (-1 on FreeBSD and OpenBSD)
228
;listen.backlog = -1
229
 
230
; List of ipv4 addresses of FastCGI clients which are allowed to connect.
231
; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
232
; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
233
; must be separated by a comma. If this value is left blank, connections will be
234
; accepted from any ip address.
235
; Default Value: any
236
;listen.allowed_clients = 127.0.0.1
237
238
; Set permissions for unix socket, if one is used. In Linux, read/write
239
; permissions must be set in order to allow connections from a web server. Many
240
; BSD-derived systems allow connections regardless of permissions. 
241
; Default Values: user and group are set as the running user
242
;                 mode is set to 0666
243
;listen.owner = www-data
244
;listen.group = www-data
245
;listen.mode = 0666
246
247
; Unix user/group of processes
248
; Note: The user is mandatory. If the group is not set, the default user's group
249
;       will be used.
250
user = www-data
251
group = www-data
252
253
; Choose how the process manager will control the number of child processes.
254
; Possible Values:
255
;   static  - a fixed number (pm.max_children) of child processes;
256
;   dynamic - the number of child processes are set dynamically based on the
257
;             following directives:
258
;             pm.max_children      - the maximum number of children that can
259
;                                    be alive at the same time.
260
;             pm.start_servers     - the number of children created on startup.
261
;             pm.min_spare_servers - the minimum number of children in 'idle'
262
;                                    state (waiting to process). If the number
263
;                                    of 'idle' processes is less than this
264
;                                    number then some children will be created.
265
;             pm.max_spare_servers - the maximum number of children in 'idle'
266
;                                    state (waiting to process). If the number
267
;                                    of 'idle' processes is greater than this
268
;                                    number then some children will be killed.
269
; Note: This value is mandatory.
270
pm = dynamic
271
272
; The number of child processes to be created when pm is set to 'static' and the
273
; maximum number of child processes to be created when pm is set to 'dynamic'.
274
; This value sets the limit on the number of simultaneous requests that will be
275
; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
276
; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
277
; CGI.
278
; Note: Used when pm is set to either 'static' or 'dynamic'
279
; Note: This value is mandatory.
280
pm.max_children = 50
281
282
; The number of child processes created on startup.
283
; Note: Used only when pm is set to 'dynamic'
284
; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
285
;pm.start_servers = 20
286
287
; The desired minimum number of idle server processes.
288
; Note: Used only when pm is set to 'dynamic'
289
; Note: Mandatory when pm is set to 'dynamic'
290
pm.min_spare_servers = 5
291
292
; The desired maximum number of idle server processes.
293
; Note: Used only when pm is set to 'dynamic'
294
; Note: Mandatory when pm is set to 'dynamic'
295
pm.max_spare_servers = 35
296
 
297
; The number of requests each child process should execute before respawning.
298
; This can be useful to work around memory leaks in 3rd party libraries. For
299
; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
300
; Default Value: 0
301
;pm.max_requests = 500
302
303
; The URI to view the FPM status page. If this value is not set, no URI will be
304
; recognized as a status page. By default, the status page shows the following
305
; information:
306
;   accepted conn        - the number of request accepted by the pool;
307
;   pool                 - the name of the pool;
308
;   process manager      - static or dynamic;
309
;   idle processes       - the number of idle processes;
310
;   active processes     - the number of active processes;
311
;   total processes      - the number of idle + active processes.
312
;   max children reached - number of times, the process limit has been reached,
313
;                          when pm tries to start more children (works only for
314
;                          pm 'dynamic')
315
; The values of 'idle processes', 'active processes' and 'total processes' are
316
; updated each second. The value of 'accepted conn' is updated in real time.
317
; Example output:
318
;   accepted conn:        12073
319
;   pool:                 www
320
;   process manager:      static
321
;   idle processes:       35
322
;   active processes:     65
323
;   total processes:      100
324
;   max children reached: 1
325
; By default the status page output is formatted as text/plain. Passing either
326
; 'html' or 'json' as a query string will return the corresponding output
327
; syntax. Example:
328
;   http://www.foo.bar/status
329
;   http://www.foo.bar/status?json
330
;   http://www.foo.bar/status?html
331
; Note: The value must start with a leading slash (/). The value can be
332
;       anything, but it may not be a good idea to use the .php extension or it
333
;       may conflict with a real PHP file.
334
; Default Value: not set 
335
;pm.status_path = /status
336
 
337
; The ping URI to call the monitoring page of FPM. If this value is not set, no
338
; URI will be recognized as a ping page. This could be used to test from outside
339
; that FPM is alive and responding, or to
340
; - create a graph of FPM availability (rrd or such);
341
; - remove a server from a group if it is not responding (load balancing);
342
; - trigger alerts for the operating team (24/7).
343
; Note: The value must start with a leading slash (/). The value can be
344
;       anything, but it may not be a good idea to use the .php extension or it
345
;       may conflict with a real PHP file.
346
; Default Value: not set
347
;ping.path = /ping
348
349
; This directive may be used to customize the response of a ping request. The
350
; response is formatted as text/plain with a 200 response code.
351
; Default Value: pong
352
;ping.response = pong
353
 
354
; The timeout for serving a single request after which the worker process will
355
; be killed. This option should be used when the 'max_execution_time' ini option
356
; does not stop script execution for some reason. A value of '0' means 'off'.
357
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
358
; Default Value: 0
359
;request_terminate_timeout = 0
360
 
361
; The timeout for serving a single request after which a PHP backtrace will be
362
; dumped to the 'slowlog' file. A value of '0s' means 'off'.
363
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
364
; Default Value: 0
365
;request_slowlog_timeout = 0
366
 
367
; The log file for slow requests
368
; Default Value: not set
369
; Note: slowlog is mandatory if request_slowlog_timeout is set
370
;slowlog = log/$pool.log.slow
371
 
372
; Set open file descriptor rlimit.
373
; Default Value: system defined value
374
;rlimit_files = 1024
375
 
376
; Set max core size rlimit.
377
; Possible Values: 'unlimited' or an integer greater or equal to 0
378
; Default Value: system defined value
379
;rlimit_core = 0
380
 
381
; Chroot to this directory at the start. This value must be defined as an
382
; absolute path. When this value is not set, chroot is not used.
383
; Note: you can prefix with '$prefix' to chroot to the pool prefix or one
384
; of its subdirectories. If the pool prefix is not set, the global prefix
385
; will be used instead.
386
; Note: chrooting is a great security feature and should be used whenever 
387
;       possible. However, all PHP paths will be relative to the chroot
388
;       (error_log, sessions.save_path, ...).
389
; Default Value: not set
390
;chroot = 
391
 
392
; Chdir to this directory at the start.
393
; Note: relative path can be used.
394
; Default Value: current directory or / when chroot
395
chdir = /
396
 
397
; Redirect worker stdout and stderr into main error log. If not set, stdout and
398
; stderr will be redirected to /dev/null according to FastCGI specs.
399
; Note: on highloaded environement, this can cause some delay in the page
400
; process time (several ms).
401
; Default Value: no
402
;catch_workers_output = yes
403
 
404
; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from
405
; the current environment.
406
; Default Value: clean env
407
;env[HOSTNAME] = $HOSTNAME
408
;env[PATH] = /usr/local/bin:/usr/bin:/bin
409
;env[TMP] = /tmp
410
;env[TMPDIR] = /tmp
411
;env[TEMP] = /tmp
412
413
; Additional php.ini defines, specific to this pool of workers. These settings
414
; overwrite the values previously defined in the php.ini. The directives are the
415
; same as the PHP SAPI:
416
;   php_value/php_flag             - you can set classic ini defines which can
417
;                                    be overwritten from PHP call 'ini_set'. 
418
;   php_admin_value/php_admin_flag - these directives won't be overwritten by
419
;                                     PHP call 'ini_set'
420
; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no.
421
422
; Defining 'extension' will load the corresponding shared extension from
423
; extension_dir. Defining 'disable_functions' or 'disable_classes' will not
424
; overwrite previously defined php.ini values, but will append the new value
425
; instead.
426
427
; Note: path INI options can be relative and will be expanded with the prefix
428
; (pool, global or /usr)
429
430
; Default Value: nothing is defined by default except the values in php.ini and
431
;                specified at startup with the -d argument
432
;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com
433
;php_flag[display_errors] = off
434
;php_admin_value[error_log] = /var/log/fpm-php.www.log
435
;php_admin_flag[log_errors] = on
436
;php_admin_value[memory_limit] = 32M