配置文件名php-fpm.conf或者www.conf(在php-fpm.d文件夹下)
[global]
pid = /var/run/php-fpm.pid
error_log = /var/log/php-fpm.log
log_level = notice
[www]
listen = /tmp/php-cgi.sock
user = www
group = www
pm = dynamic
pm.max_children = 20
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
注:将php.ini里的cgi.fix_pathinfo设置为0,不然会有漏洞~
全部修改完成后记得重启一遍php-fpm,这样会自动在/tmp/目录生成php-cgi.sock文件。博主就比较惨了,下面贴上错误内容
2018/01/19 04:38:50 [crit] 1990#0: *1 connect() to unix:/tmp/php-cgi.sock failed (2: No such file or directory) while connecting to upstream, client: 112.224.67.238, server: _, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi.sock:", host: "2008.ml"
2018/01/19 05:05:33 [alert] 2737#0: setrlimit(RLIMIT_NOFILE, 51200) failed (13: Permission denied)
本来已经配置好了php-cgi.sock结果,又来了个permission denied...学过英语童鞋应该都懂,许可拒绝,说白了就是没权限,所以这时候我也懒得搞了直接
chmod 777 /rmp/php-cgi.sock
访问网站,OK了
发表评论