1、清空原自带的配置文件
> /usr/local/php/etc/php-fpm.conf
2、编辑配置文件
vim /usr/local/php/etc/php-fpm.conf
写入以下内容
[global] pid = /usr/local/php/var/run/php-fpm.pid error_log = /usr/local/php/var/log/php-fpm.log [www] listen = /tmp/php-fcgi.sock user = php-fpm group = php-fpm pm = dynamic pm.max_children = 50 pm.start_servers = 20 pm.min_spare_servers = 5 pm.max_spare_servers = 35 pm.max_requests = 500 rlimit_files = 1024
3、检查配置文件是否正解
/usr/local/php/sbin/php-fpm -t
4、使用多个池,增加www1池
[www1] listen = /tmp/php-fcgi.sock user = php-fpm group = php-fpm pm = dynamic pm.max_children = 50 pm.start_servers = 20 pm.min_spare_servers = 5 pm.max_spare_servers = 35 pm.max_requests = 500 rlimit_files = 1024 使用多个池需要在虚拟主机配置文件中监听端口也更改相应的池 5、配置网站性能日志 加入以下两行 slowlog = /tmp/www_slow.log request_slowlog_timeout =1
6、对nginx访问路径进行限制
加入以下行
php_admin_value[open_basedir]=/usr/local/nginx/html:/tmp
本文出自 “愺艮搥豩” 博客,请务必保留此出处http://riverxyz.blog.51cto.com/533303/1784012
原文地址:http://riverxyz.blog.51cto.com/533303/1784012