下面是我的nginx.conf文件,我有两个上游,http_upstream和tcp_upstream,我使用post_action将重复的HTTP流量发送到load-balancer2.example.com:80,现在我想知道我是否可以制作使用类似于post_action的东西重复TCP / UDP流量?
daemon on;
user root;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
stream {
upstream tcp_upstream {
server server1.example.com:2000;
server server2.example.com:2000;
server server3.example.com:2000;
}
server {
listen 2000;
proxy_pass tcp_upstream;
}
}
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;
#gzip on;
client_header_buffer_size 512k;
large_client_header_buffers 4 512k;
client_max_body_size 1000M;
client_body_buffer_size 1000M;
upstream http_upstream {
server server1.example.com:8088;
server server2.example.com:8088;
server server3.example.com:8088;
}
server {
listen 80;
location / {
proxy_pass http://http_upstream/;
post_action @post_action;
}
location @post_action {
proxy_pass http://load-balancer2.example.com:80;
}
}
include /etc/nginx/conf.d/*.conf;
}