真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

ubuntu怎么將第三方模塊編譯到nginx包中

本篇內(nèi)容介紹了“ubuntu怎么將第三方模塊編譯到nginx包中”的有關(guān)知識(shí),在實(shí)際案例的操作過(guò)程中,不少人都會(huì)遇到這樣的困境,接下來(lái)就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!

讓客戶滿意是我們工作的目標(biāo),不斷超越客戶的期望值來(lái)自于我們對(duì)這個(gè)行業(yè)的熱愛。我們立志把好的技術(shù)通過(guò)有效、簡(jiǎn)單的方式提供給客戶,將通過(guò)不懈努力成為客戶在信息化領(lǐng)域值得信任、有價(jià)值的長(zhǎng)期合作伙伴,公司提供的服務(wù)項(xiàng)目有:國(guó)際域名空間、網(wǎng)絡(luò)空間、營(yíng)銷軟件、網(wǎng)站建設(shè)、淄博網(wǎng)站維護(hù)、網(wǎng)站推廣。

獲取額外的模塊

以Pagespeed、upload模塊為例。

獲取pagespeed模塊:

1

2

3

4

5

6

7

8

9

sudo mkdir /opt/pagespeed

cd /opt/pagespeed

NPS_VERSION=1.9.32.2

sudo wget https://github.com/pagespeed/ngx_pagespeed/archive/release–${NPS_VERSION}–beta.zip

sudo unzip release–${NPS_VERSION}–beta.zip

cd ngx_pagespeed–release–${NPS_VERSION}–beta/

sudo wget https://dl.google.com/dl/page–speed/psol/${NPS_VERSION}.tar.gz

sudo tar –xzvf ${NPS_VERSION}.tar.gz  # extracts to psol/

# Gives us directory /opt/pagespeed/ngx_pagespeed-release-1.9.32.2-beta

獲取upload模塊:

1

2

3

4

5

sudo mkdir /opt/httpupload

cd /opt/httpupload

sudo wget https://github.com/vkholodkov/nginx–upload–module/archive/2.2.zip

sudo unzip 2.2.zip

# Gives us directory: /opt/httpupload/nginx-upload-module-2.2

獲取nginx源碼包和依賴關(guān)系

添加nginx源,調(diào)整、重建并重新安裝nginx。

添加PPA源文件,并確保deb-src指令沒(méi)被注釋掉。

1

2

3

$ vim /etc/apt/sources.list.d/nginx–stable–trusty.list

deb http://ppa.launchpad.net/nginx/stable/ubuntu trusty main

deb–src http://ppa.launchpad.net/nginx/stable/ubuntu trusty main

更新

1

$ sudo apt–get update

獲取源碼包和依賴包

1

2

3

4

5

6

7

8

9

10

11

# Install package creation tools

sudo apt–get install –y dpkg–dev

sudo mkdir /opt/rebuildnginx

cd /opt/rebuildnginx

# Get Nginx (ppa:nginx/stable) source files

sudo apt–get source nginx

# Install the build dependencies

sudo apt–get build–dep nginx

1

2

3

4

5

$ ls –lah /opt/rebuildnginx

drwxr–xr–x 10 root root   4096 Dec 14 16:37 nginx–1.6.2/

–rw–r—r—  1 root root 934244 Dec 14 02:10 nginx_1.6.2–5+trusty0.debian.tar.gz

–rw–r—r—  1 root root   2798 Dec 14 02:10 nginx_1.6.2–5+trusty0.dsc

–rw–r—r—  1 root root 804164 Sep 18 21:31 nginx_1.6.2.orig.tar.gz

ppa:nginx/stable 提供多個(gè)nginx可用包:common, light, full, extras。當(dāng)執(zhí)行apt-get install -y nginx時(shí),是安裝full版本的。

light 比 common少了 –without-* 的選項(xiàng)包。

編輯/opt/rebuildnginx/nginx-1.6.2/debian/rules文件來(lái)添加第三方模塊。

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

full_configure_flags := \

                        $(common_configure_flags) \

                        —with–http_addition_module \

                        —with–http_dav_module \

                        —with–http_geoip_module \

                        —with–http_gzip_static_module \

                        —with–http_image_filter_module \

                        —with–http_spdy_module \

                        —with–http_sub_module \

                        —with–http_xslt_module \

                        —with–mail \

                        —with–mail_ssl_module \

                        —add–module=$(MODULESDIR)/nginx–auth–pam \

                        —add–module=$(MODULESDIR)/nginx–dav–ext–module \

                        —add–module=$(MODULESDIR)/nginx–echo \

                        —add–module=$(MODULESDIR)/nginx–upstream–fair \

                        —add–module=$(MODULESDIR)/ngx_http_substitutions_filter_module \

                        —add–module=/opt/httpupload/nginx–upload–module–2.2 \

                        —add–module=/opt/pagespeed/ngx_pagespeed–release–1.9.32.2–beta

重建nginx包

1

2

cd /opt/rebuildnginx/nginx–1.6.2

sudo dpkg–buildpackage –b

重建完后,會(huì)在/opt/rebuildnginx目錄下生產(chǎn)一堆.deb文件,可以使用這些文件來(lái)安裝nginx。由于我們調(diào)整了‘full’包,因此需要使用該包來(lái)安裝nginx。該包有兩個(gè):

1

2

nginx–full–dbg_1.6.2–5+trusty0_amd64.deb

nginx–full_1.6.2–5+trusty0_amd64.deb

dbg的是debug版本。

重新安裝nginx,可能需要先刪除之前安裝的nginx。

1

2

3

# .deb files appear one level above the `nginx-1.6.2` directory

cd /opt/rebuildnginx

sudo dpkg —install nginx–full_1.6.2–5+trusty0_amd64.deb

查看已安裝的模塊

1

2

3

4

5

6

7

8

$ nginx –V

nginx version: nginx/1.6.2

TLS SNI support enabled

configure arguments:

    —with–cc–opt=‘-g -O2 -fstack-protector –param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2’

    # A bunch of these removed for brevity

    —add–module=/opt/httpupload/nginx–upload–module–2.2            # yay!

    —add–module=/opt/pagespeed/ngx_pagespeed–release–1.9.32.2–beta # yay!

配置pagespeed

1

2

3

4

5

6

7

8

9

10

11

12

13

14

sudo mkdir –p /var/cache/ngx_pagespeed/

# Stuff up here omitted

server {

    pagespeed On;

    pagespeed FileCachePath “/var/cache/ngx_pagespeed/”;

    pagespeed EnableFilters combine_css,combine_javascript;

    # Stuff down here omitted

}

$ sudo service nginx configtest

* Testing nginx configuration            [ OK ]

# Restart, assuming it’s OK

$ sudo service nginx restart

“ubuntu怎么將第三方模塊編譯到nginx包中”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識(shí)可以關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實(shí)用文章!


文章標(biāo)題:ubuntu怎么將第三方模塊編譯到nginx包中
URL鏈接:http://weahome.cn/article/ggijgi.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部