74 lines
1.8 KiB
Nginx Configuration File
74 lines
1.8 KiB
Nginx Configuration File
worker_processes auto;
|
||
|
||
events {
|
||
worker_connections 10240;
|
||
}
|
||
|
||
http {
|
||
include 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;
|
||
error_log /var/log/nginx/error.log warn;
|
||
|
||
client_header_buffer_size 512k;
|
||
large_client_header_buffers 4 512k;
|
||
client_max_body_size 500m;
|
||
|
||
sendfile on;
|
||
server_tokens off;
|
||
|
||
gzip on;
|
||
gzip_min_length 1k;
|
||
gzip_comp_level 3;
|
||
gzip_types text/plain application/javascript application/x-javascript text/javascript text/xml text/css;
|
||
gzip_disable "MSIE [1-6]\.";
|
||
gzip_vary on;
|
||
|
||
keepalive_timeout 6500;
|
||
|
||
proxy_connect_timeout 6000;
|
||
proxy_read_timeout 6000;
|
||
proxy_send_timeout 6000;
|
||
|
||
proxy_set_header Host $host;
|
||
proxy_set_header X-Real-IP $remote_addr;
|
||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
|
||
# 默认 server:拦截无匹配请求
|
||
server {
|
||
listen 80 default_server;
|
||
location / {
|
||
return 404;
|
||
}
|
||
}
|
||
|
||
include /etc/nginx/sites/*.conf;
|
||
}
|
||
|
||
stream {
|
||
upstream http_gateway {
|
||
server 127.0.0.1:18888;
|
||
}
|
||
upstream https_gateway {
|
||
server 127.0.0.1:18889;
|
||
}
|
||
map $ssl_preread_protocol $upstream {
|
||
default http_gateway;
|
||
"TLSv1.0" https_gateway;
|
||
"TLSv1.1" https_gateway;
|
||
"TLSv1.2" https_gateway;
|
||
"TLSv1.3" https_gateway;
|
||
}
|
||
server {
|
||
listen 8888;
|
||
listen 38888;
|
||
ssl_preread on;
|
||
proxy_pass $upstream;
|
||
}
|
||
}
|