configs/nginx/nginx.conf

89 lines
1.8 KiB
Nginx Configuration File

user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 1024;
multi_accept on;
use epoll;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
server_tokens off;
server_names_hash_bucket_size 128;
server_names_hash_max_size 512;
client_header_timeout 120s;
client_body_timeout 15s;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4:!DH:!DHE ;
ssl_protocols TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
map $http_user_agent $notbot {
~*Googlebot 0;
~*bingbot 0;
~*Baiduspider 0;
~*Bytespider 0;
default 1;
}
map $notbot $bot {
0 1;
default 0;
}
access_log /var/log/nginx/access.log combined if=$notbot;
access_log /var/log/nginx/bot.log combined if=$bot;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "MSIE [1-6]\.";
gzip_vary off;
gzip_min_length 1k;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 4 16k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml
application/xml+rss text/javascript image/jpeg image/gif image/png;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" "$request_body"';
##
# Virtual Host Configs
##
proxy_cache_path /data/nginx/cache keys_zone=cache_one:200m;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}