Skip to content

Instantly share code, notes, and snippets.

@mPanasiewicz
Last active March 20, 2024 08:39
Show Gist options
  • Save mPanasiewicz/e7ae1c60d13ab34fe57d78f26747f6e6 to your computer and use it in GitHub Desktop.
Save mPanasiewicz/e7ae1c60d13ab34fe57d78f26747f6e6 to your computer and use it in GitHub Desktop.
stream {
upstream stream_backend {
server 'rabbitmq-1:5672' max_fails=2 fail_timeout=30s; # rabbitmq-1 private address in my network
server 'rabbitmq-2:5672' max_fails=2 fail_timeout=30s; # rabbitmq-2 private address in my network
server 'rabbitmq-3:5672' max_fails=2 fail_timeout=30s; # rabbitmq-3 private address in my network
}
log_format proxy '$remote_addr [$time_local] '
'$protocol $status $bytes_sent $bytes_received '
'$session_time "$upstream_addr" '
'"$upstream_bytes_sent" "$upstream_bytes_received" "$upstream_connect_time"';
access_log /var/log/nginx/stream.log proxy;
server {
listen 5672;
proxy_connect_timeout 5s;
# TCP traffic will be forwarded to the "stream_backend" upstream group
proxy_pass stream_backend;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment