centos上nginx轉發tcp請求

卡卡西村長發表於2019-06-27

下載最新版nginx

> wget http://nginx.org/download/nginx-1.17.1.tar.gz

 

解壓縮

> tar zxvf nginx-1.17.1.tar.gz

> cd nginx-1.17.1

 

配置

> ./configure --with-stream --with-stream_ssl_module

構建

> make

> make install

 

修改配置檔案

> vi /usr/local/nginx/conf/nginx.conf

stream {
  upstream server_vertica {
    server 172.16.1.1:5433;
    server 172.16.1.2:5433;
    server 172.16.1.3:5433;
  }

  server {
    listen 9501;
    proxy_connect_timeout 30s;
    proxy_timeout 3600s;
    proxy_pass server_vertica;
  }

}

 

啟動nginx

nohup /usr/local/nginx/sbin/nginx &

 

相關文章