user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
#worker_shutdown_timeout 300s;
events {
worker_connections 4096;
multi_accept on;
use epoll;
worker_aio_requests 256;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 15;
types_hash_max_size 2048;
# server_tokens off;
server_names_hash_bucket_size 128;
server_names_hash_max_size 512;
server_name_in_redirect on;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Set FireWall
##
limit_conn_zone $binary_remote_addr zone=perip:12m;
limit_conn_zone $server_name zone=perserver:12m;
limit_req_zone $binary_remote_addr zone=peripreq:12m rate=256r/s;
limit_req_zone $server_name zone=perserverreq:12m rate=5120r/s;
##
# Set GEO
##
# geoip_country /usr/share/GeoIP/GeoIP.dat;
# geoip_city /usr/share/GeoIP/GeoIPCity.dat;
##
# Cloudflare IP list
##
set_real_ip_from 103.21.244.0/22;
set_real_ip_from 103.22.200.0/22;
set_real_ip_from 103.31.4.0/22;
set_real_ip_from 104.16.0.0/12;
set_real_ip_from 108.162.192.0/18;
set_real_ip_from 131.0.72.0/22;
set_real_ip_from 141.101.64.0/18;
set_real_ip_from 162.158.0.0/15;
set_real_ip_from 172.64.0.0/13;
set_real_ip_from 173.245.48.0/20;
set_real_ip_from 188.114.96.0/20;
set_real_ip_from 190.93.240.0/20;
set_real_ip_from 197.234.240.0/22;
set_real_ip_from 198.41.128.0/17;
set_real_ip_from 2400:cb00::/32;
set_real_ip_from 2606:4700::/32;
set_real_ip_from 2803:f800::/32;
set_real_ip_from 2405:b500::/32;
set_real_ip_from 2405:8100::/32;
set_real_ip_from 2c0f:f248::/32;
set_real_ip_from 2a06:98c0::/29;
# use any of the following two
#real_ip_header CF-Connecting-IP;
real_ip_header X-Forwarded-For;
##
# Proxy Settings
##
proxy_buffering on;
proxy_buffer_size 512k;
proxy_buffers 32 512k;
proxy_busy_buffers_size 512k;
proxy_request_buffering on;
proxy_cache_valid 200 4h;
# proxy_cache_lock on;
# proxy_cache_lock_timeout 10s;
# proxy_cache_lock_age 60s;
proxy_cache_use_stale updating error timeout invalid_header http_404 http_500 http_502 http_503 http_504;
proxy_cache_revalidate on;
proxy_connect_timeout 15;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "";
proxy_intercept_errors off;
proxy_ignore_headers X-Accel-Expires Expires Cache-Control Set-Cookie Vary;
# proxy_hide_header Cache-Control Set-Cookie Expires X-Accel-Expires;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log off;
error_log /dev/null crit;
access_log /var/log/nginx/access.log;
# error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
include /etc/nginx/sites-company/*;
}
赞助一杯咖啡☕️
本文由 widdy 创作,采用 知识共享署名4.0 国际许可协议进行许可
本站文章除注明转载/出处外,均为本站原创或翻译,转载前请务必署名
最后编辑时间为: Mar 21, 2019 at 03:32 pm