nginx軟體的編譯安裝步驟

2022-05-08 20:51:12 字數 3646 閱讀 1023

[root@web02 conf]# cat /etc/redhat-release

centos release

6.8(final)

[root@web02 conf]# uname -r

2.6.32-642

.el6.x86_64

[root@web02 conf]#

yum install -y pcre-devel  openssl-devel說明:pcre-devel(支援perl nginx 定義了rewrite正則匹配語法是perl正則語法)

openssl-devel(支援nginx服務訪問,以https方式訪問)

注:要統一安裝路徑:/home/data/tools/ 下面

(解壓軟體---配置(./configure)---做菜(編譯 make)---上菜(安裝 make install))

tar xf nginx-1.10.2

.tar.gz

cd nginx-1.10.2

ls (裡面的內容就是源**(config readme安裝說明)---預設編譯會安裝到/usr/local目錄)

useradd -s /sbin/nologin -m www

--prefix=path指定安裝路徑

--user=user指定軟體啟動後以什麼什麼身份執行(主執行)

--group=group指定軟體啟動後以什麼什麼身份(屬組執行,前提使用者必須存在。

--with-http_stub_status_module    nginx的啟用狀態資訊

檢視nginx安裝時可以使用哪些配置引數

[root@web01 nginx-1.10.2

]# ##進入nginx安裝目錄路徑,檢視config 幫助資訊

[root@web01 nginx-1.10.2]# cd /home/data/tools/nginx-1.10.2/[root@web01 nginx-1.10.2

]# ls

auto changes.ru configure html makefile objs src

changes conf contrib license man readme

[root@web01 nginx-1.10.2]# ./configure --help

--help print this

message

--prefix=path set

installation prefix

--sbin-path=path set

nginx binary pathname

--modules-path=path set

modules path

--conf-path=path set

nginx.conf pathname

--error-log-path=path set

error log pathname

--pid-path=path set

nginx.pid pathname

--lock-path=path set nginx.lock pathname

cd /home/data/tools/nginx                    ##進入要編譯的檔案中

make

make install

條ln命令的意義十分深遠重大,這可是生產環境的經驗

nginx安裝路徑通過軟鏈結的方式更改為方便人員使用。

安裝時指定版本號路徑是為了便於檢視區分當前使用的nginx版本,也方便以後公升級

nginx軟體公升級編譯成新版本後,刪除原來軟鏈結就好。

程式中如果有引用nginx路徑

oksuccessful

[root@web02 sbin]#

瀏覽器訪問

10.0.0.7:80

lsof -i:80

至此軟體安裝完畢。

nginx軟體語法檢查方法:

tnginx軟體訪問測試過程:curl-v www.baidu.comnginx重啟方法

s reload關閉nginx

<---檢視原有的編譯引數資訊

nginx version: nginx/1.10.2

built by gcc

4.4.7

20120313 (red hat 4.4.7-17

) (gcc)

built with openssl

1.0.1e-fips 11 feb 2013

tls sni support enabled

編譯安裝Nginx步驟詳解

2,進入nginx解壓後的目錄執行.configure configure prefix usr local sc nginx user cali group cali with stream with threads with http ssl module with http realip mo...

Nginx的安裝步驟

yum install gcc c 二.pcre pcre devel 安裝 pcre perl compatible regular expressions 是乙個perl庫,包括 perl 相容的正規表示式庫。nginx 的 http 模組使用 pcre 來解析正規表示式,所以需要在 linux...

Nginx安裝步驟

yum install gcc c pcre perl compatible regular expressions 是乙個perl庫,包括 perl 相容的正規表示式庫。nginx 的 http 模組使用 pcre 來解析正規表示式,所以需要在 linux 上安裝 pcre 庫,pcre deve...