Nginx 的 PHP 解析功能实现如果是交由 FPM 处理的,为了提高 PHP 的处理速度,可对
FPM 模块进行参数跳转。
FPM 优化参数:
pm 使用哪种方式启动 fpm 进程,可以说 static 和 dynamic,前者将产生
固定数量的 fpm 进程,后缀将以动态的方式产生 fpm 进程
pm.max_children static 方式下开启的 fpm 进程数
pm.start_servers 动态方式下初始的 fpm 进程数量
pm.min_spare_servers 动态方式下最大的 fpm 空闲进程数
pm.max_spare_servers 动态方式下最大的 fpm 空闲进程数
[email protected] ~]# cat /usr/local/nginx/conf/nginx.conf
user nginx nginx; worker_processes 2; error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; pid logs/nginx.pid; events { use epoll; worker_connections 10240; }
http {
include mime.types;
default_type application/octet-stream;
log_format main ‘$remote_addr - $remote_user [$time_local] "$request" ‘
‘$status $body_bytes_sent "$http_referer" ‘
‘"$http_user_agent" "$http_x_forwarded_for"‘;
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
client_header_timeout 60;
client_body_timeout 60;
server_tokens off;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.1;
gzip_comp_level 2;
gzip_types text/plain text/javascript application/x-javascrip t text/css text/xml
application/xml application/xml+rss;
gzip_vary on;
server {
listen 80;
server_name www.amber.com;
charset utf-8;
access_log logs/amber.com.access.log main;
location / {
root /web/amber.com;
index index.html index.htm;
}
location ~*\.(gif|jpg|jpeg|png|bmp|ico)$ {
root /web/amber.com;
expires 1d;
valid_referers none blocked *.amber.com amber.com;
if ($invalid_referer) {
rewrite ^/ http://www.amber.com/error.jpg;
#return 403;
}
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
原文地址:https://www.cnblogs.com/cxm123123form/p/11517004.html