所需环境
安装 Tengine 需要:pcre、openssl、zlib 源码。自行下载。
操作系统:Alpine
Tengine 版本:2.3.1
Tengine 安装
-
运行用户:www
-
日志目录:/var/log/Tengine
-
临时目录:/var/tmp/Tengine
./configure --prefix=/usr/local/Tengine --pid-path=/var/run/nginx.pid --group=www --user=www --with-poll_module --without-select_module --with-threads --with-http_v2_module --add-module=./modules/ngx_http_concat_module --with-http_realip_module --with-http_image_filter_module --add-module=./modules/ngx_http_lua_module --with-lua-inc=/usr/local/include --with-lua-lib=/usr/local/lib --with-luajit-inc=/usr/local/include/luajit-2.0 --with-luajit-lib=/usr/local/lib --with-pcre=/data/source/tengine/pcre-8.42 --with-zlib=/data/source/tengine/zlib-1.2.11 --with-openssl=/data/source/tengine/openssl-1.1.1c --http-proxy-temp-path=/var/tmp/Tengine/proxy_temp --http-fastcgi-temp-path=/var/tmp/Tengine/fastcgi_temp --http-uwsgi-temp-path=/var/tmp/Tengine/uwsgi_temp --http-scgi-temp-path=/var/tmp/Tengine/cgi_temp --http-client-body-temp-path=/var/tmp/Tengine/client_body_temp --http-log-path=/var/log/Tengine/access.log --error-log-path=/var/log/Tengine/error.log
Tengine 配置
1user www www; 2worker_processes xx; # CPU 个数即可 3worker_cpu_affinity xxxx; # 参考 http://nginx.org/en/docs/ngx_core_module.html#worker_cpu_affinity 4 5error_log /var/log/Tengine/error.log; 6 7pid /var/run/nginx.pid; 8 9events { 10 use epoll; 11 worker_connections 65535; 12} 13 14http { 15 include mime.types; 16 default_type text/html; 17 charset UTF-8; 18 19 sendfile on; 20 tcp_nopush on; 21 tcp_nodelay on; 22 23 keepalive_timeout 65; 24 25 client_max_body_size 10M; # 该值需要大于最大允许上传文件大小的值 26 27 # 开启 css、js 合并 # 28 concat on; 29 concat_max_files 20; 30 concat_unique on; 31 concat_delimiter "\r\n"; 32 concat_ignore_file_error on; 33 34 # 开启 GZIP 压缩 # 35 gzip on; 36 gzip_min_length 1k; 37 gzip_buffers 4 16k; 38 gzip_http_version 1.0; 39 gzip_comp_level 2; 40 gzip_vary on; 41 gzip_types text/plain text/css text/javascript application/x-javascript application/javascript text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml application/xml-dtd; 42 43 proxy_connect_timeout 60; 44 proxy_read_timeout 60; 45 proxy_send_timeout 30; 46 proxy_buffer_size 16k; 47 proxy_buffers 4 64k; 48 proxy_busy_buffers_size 128k; 49 proxy_temp_file_write_size 128k; 50 proxy_temp_path /var/tmp/Tengine/proxy_temp_dir; 51 proxy_cache_path /var/tmp/Tengine/proxy_cache levels=1:2 keys_zone=key:2m inactive=1d max_size=1g; 52 53 ssi on; 54 ssi_silent_errors off; 55 56 log_format access '$remote_addr - $remote_user [$time_local] "$request" ' 57 '$status $body_bytes_sent "$http_referer" ' 58 '"$http_user_agent" "$http_x_forwarded_for"'; 59 60 access_log /var/log/Tengine/access.log access; 61 62 include "upstream.conf"; 63 include "vhosts.conf"; 64}