nginx 原始碼安裝

2021-08-14 16:33:52 字數 2002 閱讀 2243

//缺少 pcre 安裝包(筆者用的是ubuntu)

apt install libpcre3 libpcre3-dev

//缺少 openssl 安裝包(筆者用的是ubuntu)

apt install openssl

apt install libssl-dev

//再次執行

//nginx 指令碼內容

1 #!/bin/sh

2 ### begin init info

3 # provides: nginx

4 # required-start: $all

5 # required-stop: $all

6 # default-start: 2 3 4 5

7 # default-stop: 0 1 6

8 # description: starts and stops the nginx web server

9 ### end init info

10 11 path=/opt/nginx

12 desc="nginx daemon"

13 name="nginx"

14 15 daemon=$path/sbin/$name

16 17 configfile=$path/conf/$name.conf

18 19 pidfile=$path/logs/$name.pid

20 21 scriptname=/etc/init.d/$name

22 23 # gracefully exit if the package has been removed.

24 test -x $daemon || exit 0

25 26

27 #

28 # function that starts the daemon/service.

29 #

30 d_start()

33 34 #

35 # function that stops the daemon/service.

36 #

37 d_stop()

//將nginx 註冊為系統服務

//ubuntu

update-rc.d -f nginx defaults //註冊

update-rc.d -f nginx remove //移除

//centos

chkconfig --add nginx //註冊

chkconfig --del nginx //移除

service naginx start
curl localhost 

//或者瀏覽器輸入

localhost

nginx原始碼安裝

nginx原始碼安裝 安裝環境 作業系統 ubuntu 12.04 nginx v1.4.2 pcre v8.33 zlib v1.2.8 1.安裝zlib 1 解壓縮 plain tdtc100 ubuntu tar zxvf zlib 1.2.8.tar.gz 2 安裝 plain tdtc10...

Nginx原始碼安裝

解壓 tar zxvf nginx 1.10.0.tar.gz 執行下面的命令安裝nginx的依賴庫 yum y install gcc pcre pcre devel zlib zlib devel openssl openssl devel我這裡只配置安裝到 opt目錄下,其它選項可執行.con...

Nginx 原始碼安裝

安裝pcre庫是為了讓nginx支援具備uri重寫功能的rewrite模組 root www yum install pcre pcre devel y root www rpm qa pcre pcre devel安裝nginx 依賴的包 openssl devel root www yum in...