Installing NGINX and Third-Party Modules

Installing Nginx using a package manager

Linux(deb-based)

sudo apt-cache policy nginx

sudo apt-get update

sudo apt-get install python-software-properties
sudo apt-get install software-properties-common

sudo add-apt-repository ppa:nginx/stable
sudo apt-get update

sudo apt-get install -y nginx

sudo /etc/init.d/nginx start 

Linux(rpm-based)

sudo yum install nginx

FreeBSD

sudo pkg_install -r nginx

http://nginx.org/en/download.html

CentOS

1. add Nginx repository

sudo vi /etc/yum.repos.d/nginx.repo

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

2. install nginx

sudo yum install nginx

Debian

1. install the Nginx signing key

download from http://nginx.org/keys/nginx_signing.key

sudo apt-key add nginx_signing.key

2. append the nginx.org repository to the end of /etc/apt/sources.list

vi /etc/apt/sources.list

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

3. install nginx

sudo apt-get update
sudo apt-get install nginx

Installing Nginx from source

1. download from http://nginx.org/en/download.html

2. unpack the archive into a temporary directory

mkdir $HOME/build
cd $HOME/build && tar xzf nginx-<version-number>.tar.gz

3. configure it

cd $HOME/build/nginx-<version-number> && ./configure

4. make && sudo make install

 

posted on 2016-02-01 15:19  逝者如斯(乎)  阅读(166)  评论(0编辑  收藏  举报