63 lines
1.3 KiB
Nginx Configuration File
63 lines
1.3 KiB
Nginx Configuration File
user nginx;
|
|
worker_processes 2;
|
|
|
|
error_log /var/log/nginx/error.log warn;
|
|
pid /var/run/nginx.pid;
|
|
|
|
|
|
events {
|
|
worker_connections 4096;
|
|
}
|
|
|
|
|
|
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 120;
|
|
|
|
#gzip on;
|
|
|
|
include /etc/nginx/conf.d/*.conf;
|
|
#(配置请求体缓存区大小, 不配的话)
|
|
}
|
|
|
|
stream {
|
|
# redisd 代理
|
|
upstream redis {
|
|
hash $remote_addr consistent;
|
|
server redis:6379 weight=5 max_fails=1 fail_timeout=10s;
|
|
}
|
|
server {
|
|
listen 10001;
|
|
proxy_pass redis;
|
|
}
|
|
# redisd 代理
|
|
upstream mongo {
|
|
hash $remote_addr consistent;
|
|
server mongo:27017 weight=5 max_fails=1 fail_timeout=10s;
|
|
}
|
|
server {
|
|
listen 10002;
|
|
proxy_pass mongo;
|
|
}
|
|
# consul 代理
|
|
upstream consul {
|
|
hash $remote_addr consistent;
|
|
server consul:8500 weight=5 max_fails=1 fail_timeout=10s;
|
|
}
|
|
server {
|
|
listen 10003;
|
|
proxy_pass consul;
|
|
}
|
|
|
|
} |