nginx yum 安裝 for CentOS

 

編譯自:
http://nginx.org/en/linux_packages.htmlhtml


爲 RHEL/CentOS 設置 yum 倉庫,使 Linux 可自動升級 nginx。linux


預編譯的「stable」版程序包
------------------------

建立 /etc/yum.repos.d/nginx.repo 文件,內容以下:nginx

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/OS/OSRELEASE/$basearch/
gpgcheck=0
enabled=1


根據本身的Linux發行版,將 「OS」 替換爲 「rhel」 或者 「centos」,
根據 5.x, 6.x, 7,x 版本,將 「OSRELEASE」 替換爲 「5」, 「6」, or 「7」。centos


預編譯的「mainline」版程序包
--------------------------

建立 /etc/yum.repos.d/nginx.repo 文件,內容以下:bash

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/mainline/OS/OSRELEASE/$basearch/
gpgcheck=0
enabled=1


根據本身的Linux發行版,將 「OS」 替換爲 「rhel」 或者 「centos」,
根據 5.x, 6.x, 7,x 版本,將 「OSRELEASE」 替換爲 「5」, 「6」, or 「7」。服務器

 

編譯配置參數
---------------

預編譯程序包的 configure 參數:app

--prefix=/etc/nginx
--sbin-path=/usr/sbin/nginx
--conf-path=/etc/nginx/nginx.conf
--error-log-path=/var/log/nginx/error.log
--http-log-path=/var/log/nginx/access.log
--pid-path=/var/run/nginx.pid
--lock-path=/var/run/nginx.lock
--http-client-body-temp-path=/var/cache/nginx/client_temp
--http-proxy-temp-path=/var/cache/nginx/proxy_temp
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp
--http-scgi-temp-path=/var/cache/nginx/scgi_temp
--user=nginx
--group=nginx
--with-http_ssl_module
--with-http_realip_module
--with-http_addition_module
--with-http_sub_module
--with-http_dav_module
--with-http_flv_module
--with-http_mp4_module
--with-http_gunzip_module
--with-http_gzip_static_module
--with-http_random_index_module
--with-http_secure_link_module
--with-http_stub_status_module
--with-http_auth_request_module
--with-threads
--with-stream
--with-stream_ssl_module
--with-http_slice_module
--with-mail
--with-mail_ssl_module
--with-file-aio
--with-http_v2_module
--with-ipv6

main nginx 程序包編譯了不要求額外庫依賴的全部模塊。dom

 

動態模塊
---------------

從 nginx 1.9.11 版開始,nginx 開始支持動態模塊。目前編譯爲獨立動態模塊的以下:url

nginx-module-geoip
nginx-module-image-filter
nginx-module-njs
nginx-module-perl
nginx-module-xslt


如何加載動態模塊:spa

Syntax:    load_module file;
Default:    —
Context:    main
This directive appeared in version 1.9.11.
Loads a dynamic module.

Example:

load_module modules/ngx_mail_module.so;

 

Signatures 簽名
----------------

RPM 程序包使用數字簽名來驗證下載的程序包的完整性及是否被改動。

下載 http://nginx.org/keys/nginx_signing.key ,而後:

sudo rpm --import nginx_signing.key


由於咱們的 PGP key 和程序包位於同一個服務器,因此它們均可被信任。

咱們強烈建議驗證 PGP key 的可靠性和真實性。

PGP 有一個 「Web of Trust」 概念,具體可參考:

GPG Mini HOWTO:
http://www.dewinter.com/gnupg_howto/english/GPGMiniHowto-1.html

咱們的 keys 擁有足夠多的簽名,它們的可靠性相對來講容易驗證。

相關文章
相關標籤/搜索