安裝 make 和 gcc:
yum -y install autoconf automake make
yum -y install gcc gcc-c++
安裝nginx依賴的庫:
yum -y install pcre pcre-devel
yum -y install zlib zlib-devel
yum install -y openssl openssl-devel
解壓
tar -zxvf nginx-1.15.8.tar.gz
進入解壓好的目錄,執行配置腳本:
cd nginx-1.15.8/
./configure --prefix=/tools/nginx --with-http_stub_status_module --with-http_ssl_module
–prefix:指定安裝目錄
–with-http_stub_status_module:啓用 http 狀態監控
–with-http_ssl_module:啓用 https 模塊
creating objs/Makefile 代表編譯成功
編譯:
make
安裝:
make install
配置環境變量:
vim ~/.bash_profile
加入
export PATH=$PATH:/tools/nginx/sbin/
source 一下
source ~/.bash_profile
驗證安裝是否成功:
nginx -t