下载
yum -y install gcc pcre pcre-devel zlib zlib-devel openssl openssl-devel
wget https://nginx.org/download/nginx-1.14.0.tar.gz
tar -xzvf nginx-1.14.0.tar.gz
cd nginx-1.14.0
配置安装
./configure --prefix=/opt/nginx --sbin-path=/usr/bin/nginx --with-stream --without-http # 使用stream不使用http
make && make install
配置文件
#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 {
use epoll;
worker_connections 1024;
}
stream {
server {
listen 9008;
proxy_pass 192.168.1.125:9008;
}
}
上面本机listen端口的数据转发到,proxy_pass上去。
网友评论