1、下載Nginx安裝包
快速下載:wget http://nginx.org/download/nginx-1.18.0.tar.gz
官網下載:http://nginx.org/en/download.html

2、安裝相關依賴
安裝或更新gcc-c++ 依賴
yum -y install gcc gcc-c++ autoconf automake make
否則在安裝程序中會報錯如下:
./configure: error: C compiler cc is not found
安裝或更新pcre、openssl
yum -y install pcre-devel
yum -y install openssl openssl-devel
否則在安裝程序中會報錯如下:
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.
安裝或更新常用解壓或打包工具
yum install -y zip unzip
3、解壓Nginx安裝包
# 解壓到當前目錄
tar zxvf nginx-1.18.0.tar.gz
4、配置安裝運行目錄
# 進入nginx解壓目錄下
cd /usr/local/nginx/nginx-1.18.0
# 配置安裝運行命令
./configure --prefix=/usr/local/nginx/nginx
5、執行編譯安裝
make && make install
6、啟動Nginx
# 進入到運行目錄
cd /usr/local/nginx/nginx
# 啟動Nginx并指定組態檔 -t 測驗組態檔是否正確
./sbin/nginx -s stop -c conf/nginx.conf
# 停止Nginx -s quit(等待行程處理完畢進行關閉)
./sbin/nginx -s stop
# 重啟
./sbin/nginx -s reload
默認監聽80埠,訪問測驗即可
http://IP/
無論風雨,和自己一決勝負吧
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/539979.html
標籤:Java
上一篇:從零入門專案集成Karate和Jacoco,配置測驗代碼覆寫率
下一篇:Shell 標準輸入和輸出
