將 nginx-1.15.8.tar.gz 上傳至服務(wù)器早龟。
解壓 nginx-1.15.8.tar.gz
tar -zxvf nginx-1.15.8.tar.gz
安裝Nginx
先進入解壓后的Nginx目錄,輸入以下命令
./configure --prefix=/opt/nginx --with-http_ssl_module
// --prefix : 需要安裝到哪個目錄下
// --with-http_ssl_module:安裝SSL模塊 用于HTTPS訪問
安裝中錯誤提示:
error: the HTTP rewrite module requires the PCRE library.
安裝:
yum -y install pcre-devel
the HTTP gzip module requires the zlib library.
安裝:
yum -y install zlib-devel
SSL modules require the OpenSSL library
安裝:
yum -y install openssl openssl-devel
上面步驟編譯安裝完成后執(zhí)行
make && make install
啟動Nginx
進入nginx 安裝目錄下的 sbin 目錄
./nginx