php配置文件:
php.ini:
display_errors = Off #关闭错误提示
expose_php = Off #隐藏php版本
#禁用危险函数,禁用之后composer 会有问题,使用composer的请单独配置禁用函数
disable_functions = eval,move_uploaded_file,base_convert,chop,gzcompress,gzuncompress,get_cfg_var,rewinddir,gethostbyname,is_resource,ftp_connect,ftp_login,passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,error_log,ini_alter,ini_restore,dl,pfsockopen,syslog,readlink,symlink,popen,stream_socker_server,putenv
open_basedir = /web/ #打开地址改为项目地址
allow_url_fopen = Off #禁止远程访问
allow_url_include = Off
php-fpm:
pm.max_children = 500 #最大子进程数量
pm.start_servers = 20 #启动的子进程数量
pm.min_spare_servers = 20 #最小空闲进程数量
pm.max_spare_servers = 125 #最大空闲进程数量
request_slowlog_timeout = 8s #slow记录时间
rlimit_files = 100000 #文件限制数量
security.limit_extensions = .php #只执行.php后缀结尾的php文件
yum install php-opcache
opcache.enable=1 #开启opcache
opcache.enable_cli=1 #cli环境下,开启
opcache.memory_consumption=128 #共享内存大小
opcache.interned_strings_buffer=8 #节约内存
opcache.max_accelerated_files=8000 #缓存多少个php文件,必须大于项目的php文件总和, zendesk目前有5900文件
opcache.revalidate_freq=60 #缓存过期时间
opcache.fast_shutdown=1 #允许快速关闭