需求背景:
前段时间公司因为业务需求需要部署一个正向代理,我已经分享出来了https://www.cnblogs.com/Dfengshuo/p/11911406.html,现有因架构个更改,需要再加个在原先的反向代理下再加一层,ok,其实还是挺鸡肋的,但是没办法,领导安排就要根据安排需求做。其实nginx反向代理分两种,四层网络层代理和七层应用层代理,想要实现这两种模式很简单,只是配置文件略微不同而已。今天分享一下四层协议的代理吧!
首先安装nginx环境:
1 yum -y install pcre-devel zlib-devel gcc gcc+c++ make openssl openssl-devel 2 tar xf nginx-1.11.4.tar.gz 3 cd nginx-1.11.4/ 4 ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_gzip_static_module --with-http_ssl_module --with-http_stub_status_module --with-pcre --with-stream && make && make install