user nginx; worker_processes auto; error_log /var/log/nginx/error.log notice; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; 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; sendfile on; #tcp_nopush on; keepalive_timeout 65; ########## 以下为自定义配置 ########## #自定义变量 $connection_upgrade map $http_upgrade $connection_upgrade { default keep-alive; # 默认为 keep-alive 一般 http 请求 'websocket' upgrade; # 如果为 websocket 则 upgrade 升级 } #gzip on; # 关闭 ip 地址访问 server { listen 80 default_server; # listen 443 ssl http2; server_name _; return 403; } include /etc/nginx/conf.d/*.conf; }