nginx安装教程

nginx: Linux packages

Currently, nginx packages are available for the following distributions and versions:

RHEL/CentOS:

Version Supported Platforms
5.x x86_64, i386
6.x x86_64, i386
7.x x86_64

Debian:

Version Codename Supported Platforms
7.x wheezy x86_64, i386
8.x jessie x86_64, i386

Ubuntu:

Version Codename Supported Platforms
12.04 precise x86_64, i386
14.04 trusty x86_64, i386, aarch64/arm64
15.10 wily x86_64, i386
16.04 xenial x86_64, i386

SLES:

Version Supported Platforms
12 x86_64

To enable automatic updates of Linux packages set up the yum repository for the RHEL/CentOS distributions, the apt repository for the Debian/Ubuntu distributions, or the zypper repository for SLES.

Pre-Built Packages for Stable version

To set up the yum repository for RHEL/CentOS, create the file named /etc/yum.repos.d/nginx.repo with the following contents:

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

Replace “OS” with “rhel” or “centos”, depending on the distribution used, and “OSRELEASE” with “5”, “6”, or “7”, for 5.x, 6.x, or 7.x versions, respectively.

For Debian/Ubuntu, in order to authenticate the nginx repository signature and to eliminate warnings about missing PGP key during installation of the nginx package, it is necessary to add the key used to sign the nginx packages and repository to the apt program keyring. Please downloadthis key from our web site, and add it to the apt program keyring with the following command:

sudo apt-key add nginx_signing.key

For Debian replace codename with Debian distribution codename, and append the following to the end of the /etc/apt/sources.list file:

deb http://nginx.org/packages/debian/ codename nginx
deb-src http://nginx.org/packages/debian/ codename nginx

For Ubuntu replace codename with Ubuntu distribution codename, and append the following to the end of the /etc/apt/sources.list file:

deb http://nginx.org/packages/ubuntu/ codename nginx
deb-src http://nginx.org/packages/ubuntu/ codename nginx

For Debian/Ubuntu then run the following commands:

apt-get update
apt-get install nginx

For SLES run the following command:

zypper addrepo -G -t yum -c ‘http://nginx.org/packages/sles/12‘ nginx

Pre-Built Packages for Mainline version

To set up the yum repository for RHEL/CentOS, create the file named /etc/yum.repos.d/nginx.repo with the following contents:

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

Replace “OS” with “rhel” or “centos”, depending on the distribution used, and “OSRELEASE” with “5”, “6”, or “7”, for 5.x, 6.x, or 7.x versions, respectively.

For Debian/Ubuntu, in order to authenticate the nginx repository signature and to eliminate warnings about missing PGP key during installation of the nginx package, it is necessary to add the key used to sign the nginx packages and repository to the apt program keyring. Please downloadthis key from our web site, and add it to the apt program keyring with the following command:

sudo apt-key add nginx_signing.key

For Debian replace codename with Debian distribution codename, and append the following to the end of the /etc/apt/sources.list file:

deb http://nginx.org/packages/mainline/debian/ codename nginx
deb-src http://nginx.org/packages/mainline/debian/ codename nginx

For Ubuntu replace codename with Ubuntu distribution codename, and append the following to the end of the /etc/apt/sources.list file:

deb http://nginx.org/packages/mainline/ubuntu/ codename nginx
deb-src http://nginx.org/packages/mainline/ubuntu/ codename nginx

For Debian/Ubuntu then run the following commands:

apt-get update
apt-get install nginx

For SLES run the following command:

zypper addrepo -G -t yum -c ‘http://nginx.org/packages/mainline/sles/12‘ nginx

Configure Arguments

Configure arguments common for nginx binaries from pre-built packages:

--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 package is built with all modules that do not require additional libraries to avoid extra dependencies.

Dynamic Modules

Since version 1.9.11, nginx supports dynamic modules. Currently, the following modules are built as dynamic and shipped as separate packages:

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

Signatures

Both RPM packages and Debian/Ubuntu repositories use digital signatures to verify the integrity and origin of the downloaded package. In order to check a signature it is necessary to downloadnginx signing key and import it to the rpm or apt program’s keyring:

  • On Debian/Ubuntu:

    sudo apt-key add nginx_signing.key
  • On RHEL/CentOS:
    sudo rpm --import nginx_signing.key
  • On SLES:
    sudo rpm --import nginx_signing.key

On Debian/Ubuntu/SLES signatures are checked by default, but on RHEL/CentOS it is necessary to set

gpgcheck=1

in the /etc/yum.repos.d/nginx.repo file.

Since our PGP keys and packages are located on the same server, they are equally trusted. It is highly advised to additionally verify the authenticity of the downloaded PGP key. PGP has the “Web of Trust” concept, when a key is signed by someone else’s key, that in turn is signed by another key and so on. It often makes possible to build a chain from an arbitrary key to someone’s key who you know and trust personally, thus verify the authenticity of the first key in a chain. This concept is described in details in GPG Mini Howto. Our keys have enough signatures, and their authenticity is relatively easy to check.

时间: 2024-11-05 10:29:34

nginx安装教程的相关文章

mac nginx 安装教程

eeking a satisfactory solution to create a local web server for programming in macOS with PHP and MySQL, I was disappointed that the turnkey solutions were far from equaling the WAMP that may exist on Windows. But I forgot macOS is a Unix system, and

centos7 源码编译安装nginx教程 nginx安装脚本

安装nginx需要pcre zlib openssl的库,下文都是在官网直接下载用作编译安装 该nginx安装教程,有安装maxmind IP 库 该nginx安装教程有安装openrestry 系统使用了centos 7 该教材有修改最大打开文件描述符数到最大 该教程是nginx安装的shell脚本 #!/bin/bash yum install epel-release -y yum install gcc gcc-c++ make automake autoconf libtool ipt

Linux下nginx编译安装教程和编译参数详解

这篇文章主要介绍了Linux下nginx编译安装教程和编译参数详解,需要的朋友可以参考下 一.必要软件准备1.安装pcre 为了支持rewrite功能,我们需要安装pcre 复制代码代码如下: # yum install pcre* //如过你已经装了,请跳过这一步 2.安装openssl 需要ssl的支持,如果不需要ssl支持,请跳过这一步 复制代码代码如下: # yum install openssl* 3.gzip 类库安装 复制代码代码如下: yum install zlib zlib-

Nginx 安装以及验证教程

为了证明今天的我还活着,啊哈哈... 那就来篇Nginx安装以及验证教程. 一.标题 二.按步骤来我都总结好了 三.接着按步骤 四.按步骤 五.按步骤 六.就完了..嘻嘻,就是这么简单...嘻嘻嘻嘻啊哈哈哈啊哈哈哈. 原文地址:https://www.cnblogs.com/money131/p/10849656.html

nginx安装及其配置详细教程

1 nginx 介绍 1 什么是nginx Nginx是一款高性能的http 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器. 由俄罗斯的程序设计师Igor Sysoev所开发,官方测试nginx能够支支撑5万并发链接, 并且cpu.内存等资源消耗却非常低,运行非常稳定. 2 应用场景 1.http服务器.Nginx是一个http服务可以独立提供http服务.可以做网页静态服务器. 2.虚拟主机.可以实现在一台服务器虚拟出多个网站.例如个人网站使用的虚拟主机. 3.反向代理,负

nginx安装,简单配置动静分离,维护页面设置

nginx安装还是很简单的,虽然网上有很多的安装教程,我也看过一些,但是很多写的比较乱,比较难懂,所以就自己写一篇,希望可以帮助到大家 先说环境吧,本人用的Centos7 x86_64 同样也是现在服务器使用最多的linux发行版本,当然centos6,跟7还是有区别的,这样主要说7 第一步:先安装nginx所需要的依赖包直接yum安装就可以 yum -y install openssl zlib zlib-devel pcre pcre-devel 第二步:下载nginx安装包,我这里是指定了

LNMP编译安装之nginx安装--图文详解

LNMP编译安装之nginx安装--图文详解 1.前言 本次安装采用源码安装,主要资源包从官网下载,次要依赖则使用yum进行安装,本篇只涉及nginx的安装,不涉及nginx的配置,对应nginx如何访问php,本篇也不涉及.该教程纯属安装,不涉及任何重要知识点,老少皆宜. 2.安装步骤 nginx官网:http://nginx.org/en/download.html 2.1.下载nginx wget http://nginx.org/download/nginx-1.12.0.tar.gz

Nginx安装手册

前提是搭建yum安装环境,见前面的教程资料 Nginx安装手册1 nginx安装环境 nginx是C语言开发,建议在linux上运行,本教程使用Centos6.5作为安装环境.? gcc 安装nginx需要先将官网下载的源码进行编译,编译依赖gcc环境,如果没有gcc环境,需要安装gcc:yum install gcc-c++ ? PCRE PCRE(Perl Compatible Regular Expressions)是一个Perl库,包括 perl 兼容的正则表达式库.nginx的http

centos7_ linux : Nginx安装手册

一: nginx安装环境 1: oracle vm虚拟机+Centos7系统的yum环境的安装 1 配置本地yum库(用root用户操作) 2 创建挂载目录 3 mkdir /mnt/cdrom 4 查看挂载目录 5 ls /mnt/cdrom 6 把oracle linux7.iso安装 系统文件挂载 7 mount /dev/sr0 /mnt/cdrom/ 8 查看挂载目录 9 ls /mnt/cdrom 10 进入yum 文件 11 cd /etc/yum.repos.d/ 12 查询文件