1. 程式人生 > 其它 >Centos7安裝nginx和安裝Stream模組的編譯

Centos7安裝nginx和安裝Stream模組的編譯

nginx從1.9.0開始,新增加了一個stream模組,用來實現四層協議的轉發、代理或者負載均衡等。這完全就是搶HAproxy份額的節奏,鑑於nginx在7層負載均衡和web service上的成功,和nginx良好的框架,stream模組前景一片光明。 ngx_stream_core_module模組
是模擬反代基於tcp或udp的服務連線,即工作於傳輸層的反代或排程器

Nginx版本:1.18.0

1.下載NGINX穩定發行版

wget https://nginx.org/download/nginx-1.18.0.tar.gz

2.解壓並切換到安裝目錄

tar -zxvf nginx-1.18.0.tar.gz
cd nginx
-1.18.0

3.編譯安裝

預設路徑安裝

yum -y install gcc gcc-c++ autoconf automake
yum -y install zlib zlib-devel openssl openssl-devel pcre-devel

./configure --with-stream
make && make install


配置檔案路徑為/usr/local/nginx/conf/ 
和啟動路徑/usr/local/nginx/sbin/nginx
/usr/local/nginx/sbin/nginx-s start

指定nginx.config路徑安裝

yum -y install gcc gcc-c++ autoconf automake
yum 
-y install zlib zlib-devel openssl openssl-devel pcre-devel ./configure --prefix=/opt/nginx --sbin-path=/opt/nginx/sbin/nginx --conf-path=/opt/nginx/conf/nginx.conf --with-http_stub_status_module --with-http_gzip_static_module --with-stream make make install cd /opt/nginx
配置檔案路徑/opt/nginx/conf/nginx.conf
和啟動路徑/opt/nginx/sbin/nginx -s reload

yum解除安裝nginx參考連結 https://blog.csdn.net/a704397849/article/details/100569176

早年同窗始相知,三載瞬逝情卻萌。年少不知愁滋味,猶讀紅豆生南國。別離方知相思苦,心田紅豆根以生。