之前的Nginx的YUM源不能用了,本想着去Nginx官方网站去手工安装一下,但是发现nginx的官方也提供源的维护了。

Pre-Built Linux Packages for Stable

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

To set up the yum repository for RHEL/CentOS, choose the corresponding nginx-release package from the list:

This package contains yum configuration file and a public PGP key necessary to authenticate signed RPMs. Download and install it, then run the following:

yum install nginx

Alternatively, a repository configuration can be added manually without installing the nginx-release package. 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” or “6”, for 5.x or 6.x versions, respectively.

For Debian/Ubuntu, in order to authenticate the nginx repository signature and to eliminate warnings about missing gpg key during installation of the nginx package, it is necessary to add the key used to sign the nginx packages and repository to the aptprogram keyring. Please download this 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 6 append the following to the end of the /etc/apt/sources.list file:

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

 

For Ubuntu 10.04 append the following to the end of the /etc/apt/sources.list file:

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

 

For Debian/Ubuntu then run the following commands:

apt-get update
apt-get install nginx

如此一来方便很多,因为我是centos5系统,所以还是

rpm -Uvh http://nginx.org/packages/centos/5/noarch/RPMS/nginx-release-centos-5-0.el5.ngx.noarch.rpm
yum -y install nginx