nginx 配置4層轉發

user nginx nginx;
worker_processes auto;
pid /var/run/nginx.pid;
worker_rlimit_nofile 51200;

events {
use epoll;
worker_connections 51200;
multi_accept on;
}

stream {
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/tcp-access.log proxy ;
error_log  /var/log/nginx/tcp-error.log warn ;

server {
listen 8080;
proxy_pass test_8080;
proxy_connect_timeout 1s; #後端鏈接空閒超時斷開
proxy_timeout 10s;#後端連接超時時間
}


upstream test_8080 {
server 192.168.137.2:8080 ;
}

}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章