Nginx配置TCP/UDP流量转发
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
stream {
log_format main '$remote_addr [$time_local] '
'$protocol $status $bytes_sent $bytes_received '
'$session_time';
access_log D:/test/nginx/logs/stream-access.log main;
#include D:/test/nginx/conf.d/*.stream;
#定义nacos节点列表
upstream nacos {
server 127.0.0.1:46381;
server 127.0.0.1:46379;
server 127.0.0.1:46383;
}
#定义mysql节点列表
upstream mysql {
server 127.0.0.1:33060;
}
#定义doris接地那列表
upstream doris {
server 127.0.0.1:9030;
}
# 定义mysql虚拟机
server {
listen 33060;
proxy_timeout 30s;
proxy_pass mysql;
}
# 定义doris虚拟机
server {
listen 9030;
proxy_timeout 30s;
proxy_pass doris;
}
# 定义nacos虚拟机
server {
listen 46381;
proxy_timeout 30s;
proxy_pass nacos;
}
}