设为首页 收藏本站
查看: 833|回复: 0

[经验分享] Puppet函数介绍(十八)

[复制链接]

尚未签到

发表于 2018-8-1 13:16:27 | 显示全部楼层 |阅读模式
[root@sh-proxy2 php-fpm.d]# puppet agent -t  
Info: Retrieving pluginfacts
  
Info: Retrieving plugin
  
Info: Loading facts
  
Info: Caching catalog for sh-proxy2.localdomain
  
Info: Applying configuration version '1506534804'
  
Notice: /Stage[main]/Admin/Exec[selinux]/returns: executed successfully
  
Notice: /Stage[main]/Php::Phpfpmconf/Php::Phpfpmconf::Generatephpfpmfiles[sh-proxy2]/File[/etc/php-fpm.d/www.conf]/content:
  
--- /etc/php-fpm.d/www.conf2017-03-22 20:29:28.000000000 +0800
  
+++ /tmp/puppet-file20170928-96466-ix9fq8-02017-09-28 01:53:24.115952791 +0800
  
@@ -1,3 +1,13 @@
  
+[global]
  
+; Pid file
  
+; Default Value: none
  
+pid = /var/run/php-fpm_www.pid
  
+
  
+
  
+; Error log file
  
+; Default Value: /usr/local/var/log/php-fpm.log
  
+error_log = /var/log/php-fpm/php-fpm.error.log
  
+
  
; Start a new pool named 'www'.
  
[www]
  

  
@@ -9,11 +19,14 @@
  
;                            specific port;
  
;   '/path/to/unix/socket' - to listen on a unix socket.
  
; Note: This value is mandatory.
  
-listen = 127.0.0.1:9000
  
+
  
+
  
+listen = 9000
  
+
  

  
; Set listen(2) backlog. A value of '-1' means unlimited.
  
; Default Value: -1
  
-;listen.backlog = -1
  
+listen.backlog = 4096
  

  
; List of ipv4 addresses of FastCGI clients which are allowed to connect.
  
; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
  
@@ -21,7 +34,7 @@
  
; must be separated by a comma. If this value is left blank, connections will be
  
; accepted from any ip address.
  
; Default Value: any
  
-listen.allowed_clients = 127.0.0.1
  
+;listen.allowed_clients =
  

  
; Set permissions for unix socket, if one is used. In Linux, read/write
  
; permissions must be set in order to allow connections from a web server. Many
  
@@ -36,9 +49,9 @@
  
; Note: The user is mandatory. If the group is not set, the default user's group
  
;       will be used.
  
; RPM: apache Choosed to be able to access some dir as httpd
  
-user = apache
  
+user = nobody
  
; RPM: Keep a group allowed to write in log dir.
  
-group = apache
  
+group = www
  

  
; Choose how the process manager will control the number of child processes.
  
; Possible Values:
  
@@ -57,7 +70,7 @@
  
;                                    of 'idle' processes is greater than this
  
;                                    number then some children will be killed.
  
; Note: This value is mandatory.
  
-pm = dynamic
  
+pm = static
  

  
; The number of child processes to be created when pm is set to 'static' and the
  
; maximum number of child processes to be created when pm is set to 'dynamic'.
  
@@ -67,12 +80,12 @@
  
; CGI.
  
; Note: Used when pm is set to either 'static' or 'dynamic'
  
; Note: This value is mandatory.
  
-pm.max_children = 50
  
+pm.max_children = 20
  

  
; The number of child processes created on startup.
  
; Note: Used only when pm is set to 'dynamic'
  
; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
  
-pm.start_servers = 5
  
+pm.start_servers = 12
  

  
; The desired minimum number of idle server processes.
  
; Note: Used only when pm is set to 'dynamic'
  
@@ -82,13 +95,13 @@
  
; The desired maximum number of idle server processes.
  
; Note: Used only when pm is set to 'dynamic'
  
; Note: Mandatory when pm is set to 'dynamic'
  
-pm.max_spare_servers = 35
  
+pm.max_spare_servers = 20
  

  
; The number of requests each child process should execute before respawning.
  
; This can be useful to work around memory leaks in 3rd party libraries. For
  
; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
  
-; Default Value: 0
  
-;pm.max_requests = 500
  
+; Default Value: -2
  
+pm.max_requests = 5000
  

  
; The URI to view the FPM status page. If this value is not set, no URI will be
  
; recognized as a status page. By default, the status page shows the following
  
@@ -118,7 +131,7 @@
  
;       anything, but it may not be a good idea to use the .php extension or it
  
;       may conflict with a real PHP file.
  
; Default Value: not set
  
-;pm.status_path = /status
  
+pm.status_path = /status
  

  
; The ping URI to call the monitoring page of FPM. If this value is not set, no
  
; URI will be recognized as a ping page. This could be used to test from outside
  
@@ -135,20 +148,20 @@
  
; This directive may be used to customize the response of a ping request. The
  
; response is formatted as text/plain with a 200 response code.
  
; Default Value: pong
  
-;ping.response = pong
  
+ping.response = pong
  

  
; The timeout for serving a single request after which the worker process will
  
; be killed. This option should be used when the 'max_execution_time' ini option
  
; does not stop script execution for some reason. A value of '0' means 'off'.
  
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
  
; Default Value: 0
  
-;request_terminate_timeout = 0
  
+request_terminate_timeout = 0
  

  
; The timeout for serving a single request after which a PHP backtrace will be
  
; dumped to the 'slowlog' file. A value of '0s' means 'off'.
  
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
  
; Default Value: 0
  
-;request_slowlog_timeout = 0
  
+request_slowlog_timeout = 10
  

  
; The log file for slow requests
  
; Default Value: not set
  
@@ -179,24 +192,16 @@
  
; Redirect worker stdout and stderr into main error log. If not set, stdout and
  
; stderr will be redirected to /dev/null according to FastCGI specs.
  
; Default Value: no
  
-;catch_workers_output = yes
  
+catch_workers_output = yes
  

  
-; Limits the extensions of the main script FPM will allow to parse. This can
  
-; prevent configuration mistakes on the web server side. You should only limit
  
-; FPM to .php extensions to prevent malicious users to use other extensions to
  
-; exectute php code.
  
-; Note: set an empty value to allow all extensions.
  
-; Default Value: .php
  
-;security.limit_extensions = .php .php3 .php4 .php5
  
-
  
; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from
  
; the current environment.
  
; Default Value: clean env
  
-;env[HOSTNAME] = $HOSTNAME
  
-;env[PATH] = /usr/local/bin:/usr/bin:/bin
  
-;env[TMP] = /tmp
  
-;env[TMPDIR] = /tmp
  
-;env[TEMP] = /tmp
  
+env[HOSTNAME] = $HOSTNAME
  
+env[PATH] = /usr/local/bin:/usr/bin:/bin
  
+env[TMP] = /tmp
  
+env[TMPDIR] = /tmp
  
+env[TEMP] = /tmp
  

  
; Additional php.ini defines, specific to this pool of workers. These settings
  
; overwrite the values previously defined in the php.ini. The directives are the
  
@@ -215,12 +220,10 @@
  
; Default Value: nothing is defined by default except the values in php.ini and
  
;                specified at startup with the -d argument
  
;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com
  
-;php_flag[display_errors] = off
  
-php_admin_value[error_log] = /var/log/php-fpm/www-error.log
  
+php_flag[display_errors] = on
  
+php_admin_value[error_log] = /var/log/php-fpm/www.error.log
  
php_admin_flag[log_errors] = on
  
-;php_admin_value[memory_limit] = 128M
  
-
  
-; Set session path to a directory owned by process user
  
-php_value[session.save_handler] = files
  
-php_value[session.save_path] = /var/lib/php/session
  
+;php_admin_value[memory_limit] = 32M
  

  
+;add by zkf . add some file support. p file is used by channel.
  
+security.limit_extensions = .php .php3 .php4 .php5 .html .do .js .css .htm p
  
\ No newline at end of file
  
Info: Computing checksum on file /etc/php-fpm.d/www.conf
  
Info: /Stage[main]/Php::Phpfpmconf/Php::Phpfpmconf::Generatephpfpmfiles[sh-proxy2]/File[/etc/php-fpm.d/www.conf]: Filebucketed /etc/php-fpm.d/www.conf to puppet with sum 2402465907d7a7544db6315c55248938
  
Notice: /Stage[main]/Php::Phpfpmconf/Php::Phpfpmconf::Generatephpfpmfiles[sh-proxy2]/File[/etc/php-fpm.d/www.conf]/content: content changed '{md5}2402465907d7a7544db6315c55248938' to '{md5}a8ef2b23bd9feab1848d3dfe27ab1bd6'
  
Notice: Finished catalog run in 0.56 seconds
  
grep过滤修改的参数查看是否改变了:
  
[root@sh-proxy2 php-fpm.d]# cat www.conf | grep requests
  
; The address on which to accept FastCGI requests.
  
; This value sets the limit on the number of simultaneous requests that will be
  
; The number of requests each child process should execute before respawning.
  
pm.max_requests = 5000
  
; The log file for slow requests

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-544837-1-1.html 上篇帖子: Puppet正则表达式(十七) 下篇帖子: Puppet代码书写规范(十九)
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表