官方文档 http://tengine.taobao.org/
tengine主配置文件
cat /usr/local/nginx/conf/nginx.conf
user nobody nobody;
worker_processes 8;
#error_log /www/nginx/logs/nginx_debug.log debug_http;
error_log /www/nginx/logs/nginx_error.log error;
#error_log /www/nginx/logs/nginx_notice.log notice;
#error_log /www/nginx/logs/nginx_info.log info;
pid /var/run/nginx.pid;
worker_rlimit_nofile 102400;
events {
use epoll;
worker_connections 102400;
}
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"';
# log_format for base_nginx_log
log_format base_nginx_log ' $remote_addr - $remote_user [$time_local] $msec '
' $host $request $status $http_accept_encoding $body_bytes_sent $http_referer $http_user_agent '
' $http_cookie $upstream_addr $upstream_response_time $request_time $connection_requests $upstream_cache_status '
;
#access_log logs/access.log main;
server_names_hash_bucket_size 512;
client_header_buffer_size 32k;
large_client_header_buffers 8 32k;
client_max_body_size 100m;
client_body_buffer_size 128k;
client_body_temp_path /lvm_cache/nginx/client_temp 1 2;
sendfile on;
tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
tcp_nodelay on;
server_tokens off;
server_tag nginx;
index index.html index.htm index.jsp;
add_header X-UA-Compatible "IE=EmulateIE7";
# add_header X-Cache '$upstream_cache_status';
open_file_cache max=102400 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 1;
####### begin gzip #######
gzip off;
gzip_min_length 100;
gzip_buffers 64 32k;
gzip_http_version 1.1;
gzip_proxied any;
gzip_comp_level 9;
gzip_types text/plain text/css text/xml application/xml text/javascript application/x-javascript application/json;
gzip_vary on;
####### end gzip #######
#######begin proxy #######
proxy_redirect off;
proxy_connect_timeout 15;
proxy_send_timeout 60;
proxy_read_timeout 60;
proxy_buffer_size 64k;
proxy_buffers 32 64k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 512k;
proxy_temp_path /lvm_cache/nginx/proxy_temp;
proxy_pass_header Set-Cookie;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504 http_404;
#fastcgi_next_upstream error timeout invalid_header http_500 http_503 http_404;
proxy_next_upstream error timeout http_500 http_502 http_503 http_504;
proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504 http_404;
proxy_cache_path /lvm_cache/nginx/cache_test levels=1:2 keys_zone=cache_test:100m inactive=1d max_size=300m;
#gzip on;
#
server {
listen 88;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ .php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ .php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /.ht {
# deny all;
#}
}
server {
listen 10.10.10.10:88;
server_name 10.10.10.10;
location ^~ /nginx_status {
stub_status on;
}
location ^~ /cluster_status {
check_status;
access_log off;
allow 10.10.10.10;
allow 10.10.10.0/28;
deny all;
}
# location ^~ /httpcode_status {
# show_status_code_count on;
#
# }
# location ^~/ttlsa-req-status {
# req_status_show;
#
# }
location ~ /purge(/.*) {
#allow 10.10.10.20;
#deny all;
proxy_cache_purge cache_test $http_referer$1$is_args$args;
}
location ~ /purge_test(/.*) {
proxy_cache_purge cache_test $http_referer$1$is_args$args;
}
access_log off;
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
#include /usr/local/nginx/conf/cluster.conf;
include /usr/local/nginx/conf/cluster/*.conf;
include /usr/local/nginx/conf/include/*.conf;
}