编译自:
http://nginx.org/en/linux_packages.htmlhtml
为 RHEL/CentOS 设置 yum 仓库,使 Linux 可自动升级 nginx。linux
建立 /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
建立 /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;
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 拥有足够多的签名,它们的可靠性相对来讲容易验证。