# user root; worker_processes auto; worker_rlimit_nofile 50000; error_log /usr/local/nginx/logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; pid /var/run/nginx.pid; #load_module "modules/ngx_http_geoip2_module.so"; #load_module "modules/ngx_http_substitutions_filter_module.so"; events { use epoll; worker_connections 51200; #worker_connections 1024; multi_accept on; } #stream stream { #定义日志格式 log_format proxy '$remote_addr [$time_local] ' '$protocol $status $bytes_sent $bytes_received ' '$session_time "$upstream_addr" ' '"$upstream_bytes_sent" "$upstream_bytes_received" "$upstream_connect_time"'; #stream日志路径 access_log /usr/local/nginx/logs/stream-access.log proxy; open_log_file_cache off; #载入stream配置 include /usr/local/nginx/conf/stream/*.conf; } http { #include GeoLite2 #geoip2 /usr/local/nginx/GeoLite2/GeoLite2-Country.mmdb { # auto_reload 5m; # $geoip2_metadata_country_build metadata build_epoch; # $geoip2_data_country_code default=US source=$remote_addr country iso_code; # $geoip2_data_continent_code default=EU source=$remote_addr continent code; # $geoip2_data_country_name country names en; # } # geoip2 /usr/local/nginx/GeoLite2/GeoLite2-City.mmdb { # $geoip2_data_city_name default=London city names en; # } include /usr/local/nginx/conf/mime.types; default_type application/octet-stream; server_names_hash_bucket_size 128; client_header_buffer_size 32k; large_client_header_buffers 4 32k; client_max_body_size 1024m; client_body_buffer_size 10m; sendfile on; tcp_nopush on; keepalive_timeout 120; server_tokens off; tcp_nodelay on; proxy_headers_hash_max_size 51200; proxy_headers_hash_bucket_size 6400; #开启Brotli压缩 brotli on; brotli_comp_level 6; #最小长度 brotli_min_length 512; brotli_types text/plain text/javascript text/css text/xml text/x-component application/javascript application/x-javascript application/xml application/json application/xhtml+xml application/rss+xml application/atom+xml application/x-font-ttf application/vnd.ms-fontobject image/svg+xml image/x-icon font/opentype; brotli_static always; gzip on; gzip_buffers 16 8k; gzip_comp_level 6; gzip_http_version 1.1; gzip_min_length 256; gzip_proxied any; gzip_vary on; gzip_types text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml text/javascript application/javascript application/x-javascript text/x-json application/json application/x-web-app-manifest+json text/css text/plain text/x-component font/opentype application/x-font-ttf application/vnd.ms-fontobject image/x-icon; gzip_disable "MSIE [1-6]\.(?!.*SV1)"; #If you have a lot of static files to serve through Nginx then caching of the files' metadata (not the actual files' contents) can save some latency. open_file_cache max=1000 inactive=20s; open_file_cache_valid 30s; open_file_cache_min_uses 2; open_file_cache_errors on; # default site server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; root /var/www/html/default; index index.php index.html index.htm; # PHP 配置 location ~ [^/]\.php(/|$) { include fastcgi_params; fastcgi_pass 127.0.0.1:9074; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } #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; } } #载入额外的配置 include /usr/local/nginx/conf/cdn/*.conf; include /usr/local/nginx/conf/vhost/*.conf; }