说明:高性能服务器通过配置nginx和php-fpm,代替docker容器技术,实现请求服务高并发处理。
主要说明配置主要参数,以及想过解释。
nginx主要配置
通过nginx实现php-fpm服务器负载,用户访问服务时,将请求分配给不同的php-fpm服务器。
# nginx启动worker进程数
worker_processes auto;
#Changes the limit on the maximum number of open files (RLIMIT_NOFILE) for worker processes.定义进程可以打开的最大文件数,与linux内核相同即可
worker_rlimit_nofile 65535;
# 定义worker进程的优先级,数字越小优先级越高 [-20,19]
worker_priority -20;
events{
# The maximum number of connections that each worker process can handle simultaneously.每个进程同时处理的连接数
worker_connections 10240;
# If multi_accept is disabled, a worker process will accept one new connection at a time. Otherwise, a worker process will accept all new connections at a time.
multi_accept on;
}
http{
access_log /var/log/nginx/access.log main buffer=32k;
# Nginx将使用sendfile内核来调用处理文件传递