第二步:配置nginx安裝所需的環境
第三步: 解壓nginx壓縮包並安裝
第四步:編譯安裝nginx
第五步:啟動nginx
第五步:nginx配置
.0.tar.gz
yum install -y gcc-c++
nginx的rewrite模組和http核心模組會使用到pcre正規表示式語法。這裡需要安裝兩個安裝包pcre和pcre-devel。第乙個安裝包提供編譯版本的庫,而第二個提供開發階段的標頭檔案和編譯專案的源**。安裝指令如下:
yum install -y pcre pcre-devel
zlib庫提供了開發人員的壓縮演算法,在nginx的各種模組中需要使用gzip壓縮。安裝指令如下:
yum install -y zlib zlib-devel
nginx不僅支援 http協議,還支援 https(即在 ssl 協議上傳輸 http),如果使用了 https,需要安裝 openssl 庫。安裝指令如下:
yum install -y openssl openssl-devel
然後進行配置,預設配置tar -zxvf nginx-
1.18
.0.tar.gz
cd nginx-
1.18
.0
如果需要開始https支援,stream tcp**.
/configure
-stream編譯
make
安裝
make install
進入/usr/local/nginx/sbin目錄,輸入./nginx即可啟動nginx
關閉nginxcd /usr/local/nginx/sbin
./nginx
./nginx -s quit 或者 ./nginx -s stop
重啟nginx
./nginx -s reload
檢視nginx程序
ps aux|grep nginx
設定nginx開機啟動,只需在rc.local增加啟動**即可。
新增如下單元或修改原配置檔案cd /usr/local/nginx/conf
vim nginx.conf
tcp**upstream ***proxy
#配置**
server
error_page 500 502 503 504 /50x.html;
location = /50x.html
location /***
}#配置靜態資源
server
error_page 500 502 503 504 /50x.html;
location = /50x.html
location /demo
}#tcp**
include /usr/loacl/nginx/conf/tcp/*.conf;
stream
server
nginx 安裝記錄
gcc yum install gcc c pcre pcre perl compatible regular expressions 是乙個perl庫,包括 perl 相容的正規表示式庫。nginx的http模組使用pcre來解析正規表示式,所以需要在linux上安裝pcre庫。注 pcre de...
Nginx和Tomcat安裝記錄
2.解壓縮nginx,執行如下命令 cd nginx 1.7.7 configure 3.configure出錯,需要安裝pcre 5.在 usr local下解壓縮並編譯安裝 configure prefix usr local pcre make make install 6.重新嘗試安裝 ng...
nginx安裝過程記錄
安裝環境 樹莓派3b ubuntu16.04 具體步驟 解壓壓縮包 建立安裝路徑 opt nginx 編譯安裝 cd tmp nginx 1.17.2 configure prefix opt nginx 遇到問題 pcre庫不存在 configure prefix opt nginx with p...