ngx-gateway/ngx/etc/nginx.conf

51 lines
1.1 KiB
Nginx Configuration File
Raw Permalink Normal View History

2024-02-04 20:39:43 +08:00
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;
########## 以下为自定义配置 ##########
2024-02-04 20:52:15 +08:00
# 向 docker dns 请求容器 ip 过期时间 1s
resolver 127.0.0.11 valid=1s;
2024-02-04 20:39:43 +08:00
#自定义变量 $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;
}