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.piderror_log = /usr/local/php/var/log/php-fpm.log[www]listen = /tmp/php-fcgi.sockuser = php-fpmgroup = php-fpmpm = dynamicpm.max_children = 50pm.start_servers = 20pm.min_spare_servers = 5pm.max_spare_servers = 35pm.max_requests = 500rlimit_files = 1024
3、检查配置文件是否正解
/usr/local/php/sbin/php-fpm -t
4、使用多个池,增加www1池
[www1]listen = /tmp/php-fcgi.sockuser = php-fpmgroup = php-fpmpm = dynamicpm.max_children = 50pm.start_servers = 20pm.min_spare_servers = 5pm.max_spare_servers = 35pm.max_requests = 500rlimit_files = 1024使用多个池需要在虚拟主机配置文件中监听端口也更改相应的池5、配置网站性能日志加入以下两行slowlog = /tmp/www_slow.logrequest_slowlog_timeout =1
6、对nginx访问路径进行限制
加入以下行
php_admin_value[open_basedir]=/usr/local/nginx/html:/tmp