Tengine 配置优化小结

18-03-22 12:03 22743 0 技术

什么是 Tengine?

Tengine是由淘宝网发起的Web服务器项目。它在Nginx的基础上,针对大访问量网站的需求,添加了很多高级功能和特性。Tengine的性能和稳定性已经在大型的网站如淘宝网,天猫商城等得到了很好的检验。它的最终目标是打造一个高效、稳定、安全、易用的Web平台。

从2011年12月开始,Tengine成为一个开源项目,Tengine团队在积极地开发和维护着它。Tengine团队的核心成员来自于淘宝、搜狗等互联网企业。Tengine是社区合作的成果,我们欢迎大家参与其中,贡献自己的力量。

配置文件参数优化

打开配置文件,默认位置在 /usr/local/nginx/conf/nginx.conf

# 工作进程数,一般设置为 CPU 的核心数,最高可以设为核心数的 2 倍
worker_processes 4;

# nginx 日志的记录格式
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  "pipe:rollback logs/access_log interval=1d baknum=7 maxsize=2G"  main;

# 开启 gzip
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.1;
gzip_comp_level 9;
gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml application/xml+rss;
gzip_vary on;
gzip_proxied expired no-cache no-store private auth;
gzip_disable "MSIE [1-6]\.";

重启 WEB 服务器

/usr/local/nginx/sbin/nginx -s reload
请登录后发表评论 点击登录

文章归档

文章日历

2024 年 04 月
29 01 02 03 04 05 06
07 08 09 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
29 30 01 02 03 04 05

文章标签

最新评论

友情链接