标签:bmp 优化 ash date none ali min 修改 fine
nginx 优化配置crontab -e
0 1 /opt/fenge.sh
---------------------------------超时设置------------------------------------------------
vim /usr/local/nginx/conf/nginx.conf
keepalive_timeout 65 180;
#180:客户端超时时间
#65:服务器超时时间
client_header_timeout 80;
#请求头部超时时间
client_body_timeout 80;
#body主体超时时间
#默认单位 “秒”
------------------------------------------更改进程数------------------------------------
cat /proc/cpuinfo | grep -c "physical" #CPU 核数
vim /usr/local/nginx/conf/nginx.conf
worker_processes 2
events {
worker_connections 4096;
}
ps aux | grep nginx #查看进程数量
--------------------------------网页压缩-----------------------------------------
vim /usr/local/nginx/conf/nginx.conf
添加如下内容:
gzip on;
gzip_buffers 4 64k;
gzip_http_version 1.1;
gzip_comp_level 2;
gzip_min_length 1k;
gzip_vary on;
gzip_types text/plain text/javascript application/x-javascript text/csstext/xml application/xml application/xml+rss test/jpg test/png;
------------------------------------防盗链-------------------------------------------
vim /usr/local/nginx/conf/nginx.conf
添加如下内容:
location ~.(jpg|gif|swf)$ {
valid_referers none blocked *.baidu.com baidu.com;
if ( $invalid_referer ) {
rewrite / http://www.baidu.com/error.png;
}
}
---------------------------------------fpm参数优化---------------------------------------------
pid = run/php-fpm.pid
pm = dynamic
pm.max_children=20
pm.start_servers = 5
pm.min_spare_servers = 2
pm.max_spare_servers = 8
标签:bmp 优化 ash date none ali min 修改 fine
原文地址:http://blog.51cto.com/13746824/2161543