nginx安裝及安裝問題記錄
##安裝包下載下傳
Nginx安裝包:選擇最新的即可
http://nginx.org/en/download.html
本次下載下傳的是:nginx-1.19.0.tar.gz
Pcre下載下傳界面:選擇pcre最新的安裝包即可
https://ftp.pcre.org/pub/pcre/
本次下載下傳的是:pcre-8.44.tar.gz
安裝pcre步驟
安裝前可用rpm指令确認是否已安裝,如下是有安裝的則無需安裝
$ rpm -qa|grep pcre
pcre-7.8-6.el6.x86_64
pcre-devel-7.8-6.el6.x86_64
如未安裝則參考如下步驟:
解壓安裝包:
#tar -zxvf pcre-8.44.tar.gz
進入安裝包目錄:
#cd pcre-8.44
編譯安裝:
#./configure
#make
#make install
檢視pcre版本
#pcre-config --version)
Nginx安裝前準備:
對于nginx編譯安裝需要先安裝編譯 的工具,然後再安裝nginx依賴
yum -y install gcc gcc-c++ autoconf automake make
yum -y install zlib zlib-devel openssl openssl-devel pcre pcre-devel
Nginx安裝
編譯:(upstream子產品,預設自帶:)
如下4個參數分别表示:指定使用者,指定使用者組,指定安裝路徑,指定pcre解壓後的目錄
#./configure --user=portal --group=aiip --prefix=/data/potal/nginx --with-pcre=/data/portal/pcre-8.44
#make
#make install
安裝後操作參考(如下路徑修改成實際路徑)
#啟動 nginx服務
/portal/nginx/sbin/nginx
#停止服務
/portal/nginx/sbin/nginx -s stop
#重新開機服務
/portal/nginx/sbin/nginx -s reload
#檢視啟動情況
ps -ef|grep nginx
#檢視是否啟動成功
curl 192.168.1.1
#檢視端口情況
netstat -ano|grep 8080
#檢視nginx版本
./portal/nginx -V.
Nginx安裝報錯1
./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=
option.
原因:缺pcre包
解決辦法:安裝pcre即可
Nginx安裝報錯2
Make的時候報錯:
原因:
nginx順帶編譯了pcre,不需要單獨編譯
解決辦法:
pcre重新指定下,指定成沒編譯的