worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 8080;
server_name localhost;
location / {
root html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
stream {
upstream socket {
hash $remote_addr consistent;
server 127.0.0.1:15051 weight=1 ;
}
server {
listen 8090;
proxy_connect_timeout 100s;
proxy_timeout 100s;
proxy_pass socket;
}
}
外部访问8090,nginx跳转到15051,nginx转发socket协议的配置写法,TCP协议传输