user www–data;
worker_processes auto;
pid/run/nginx.pid;
events{
useepoll;
multi_accept on;
reuse_port on;
worker_connections 1048576;
}
dso{# 动态加载功能模块 /usr/share/nginx/modules
load ngx_http_memcached_module.so;
load ngx_http_limit_conn_module.so;
load ngx_http_empty_gif_module.so;
load ngx_http_scgi_module.so;
load ngx_http_upstream_session_sticky_module.so;
load ngx_http_user_agent_module.so;
load ngx_http_referer_module.so;
load ngx_http_upstream_least_conn_module.so;
load ngx_http_uwsgi_module.so;
load ngx_http_reqstat_module.so;
load ngx_http_browser_module.so;
load ngx_http_limit_req_module.so;
load ngx_http_split_clients_module.so;
load ngx_http_upstream_ip_hash_module.so;
}
http{
include /etc/nginx/mime.types;
default_type text/plain;
access_log off;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
server_tokens off;
keepalive_timeout 120;
server_names_hash_bucket_size512;
server_name_in_redirect off;
fastcgi_connect_timeout3s;
fastcgi_send_timeout3s;
fastcgi_read_timeout3s;
fastcgi_buffer_size128k;
fastcgi_buffers8128k;
fastcgi_busy_buffers_size256k;
fastcgi_temp_file_write_size256k;
variables_hash_max_size 1024;
set_real_ip_from10.0.0.0/8;
set_real_ip_from172.28.0.0/16;
set_real_ip_from192.168.0.0/16;
real_ip_headerX–Forwarded–For;
gzip off;
gzip_disable“msie6”;
gzip_min_length1k;
gzip_buffers1664k;
gzip_http_version1.1;
gzip_comp_level6;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
gzip_vary on;
ssl_protocols TLSv1 TLSv1.1TLSv1.2;# Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
access_log/var/log/nginx/access.log;
error_log/var/log/nginx/error.log;
server{
listen 80backlog=65535;
charset utf–8;
location/{# 打印Tengine状态页
stub_status on;# 开启状态页,依赖 http_stub_status_module 模块
access_log off;#访问过程不记日志
}
location~^(.*)\/\.(svn|git|hg|bzr|cvs)\/{# 屏蔽这些目录
deny all;
access_log off;
log_not_found off;
}
location~/\.{# 屏蔽.开头的目录或文件,比如 .htaccess .bash_history
deny all;
access_log off;
log_not_found off;
}
location/do_not_delete.html{
access_log off;
empty_gif;
}
}
}