# For more information on configuration, see: # * Official English Documentation: http://nginx.org/en/docs/ # * Official Russian Documentation: http://nginx.org/ru/docs/ user nginx; worker_processes auto; error_log /var/log/nginx/error.log; pid /run/nginx.pid; # Load dynamic modules. See /usr/share/nginx/README.dynamic. include /usr/share/nginx/modules/*.conf; events { worker_connections 1024; } http { 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 /var/log/nginx/access.log main; limit_req_zone $binary_remote_addr zone=myRateLimit:10m rate=10r/s; sendfile on; #tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; include /etc/nginx/mime.types; default_type application/octet-stream; client_max_body_size 20m; gzip on; #打开gzip压缩功能 gzip_min_length 1k; #压缩阈值 gzip_buffers 4 16k; #buffer 不用修改 gzip_comp_level 5; #压缩级别:1-10,数字越大压缩的越好,时间也越长 gzip_static on; gzip_types application/atom+xml # 这个application/x-javascript还是有区别的 application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component application/octet-stream text/x-cross-domain-policy; gzip_disable "MSIE [1-6]\."; #IE1-6版本不支持gzip压缩 include /etc/nginx/conf.d/*.conf; }