ubuntu/debain上安装最新的nginx

Ubuntu自带更新程序默认的nginx并非新版,要安装最新的nginx,以stable版为例(1.2.10),最简便方法是:

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

或者
apt-key add nginx_signing.key
deb http://nginx.org/packages/ubuntu/ codename nginx
deb-src http://nginx.org/packages/ubuntu/ codename nginx

ubuntu的codename:

12.04 precise x86_64, i386
14.04 trusty x86_64, i386, aarch64/arm64
16.04 xenial x86_64, i386, ppc64el
16.10 yakkety x86_64, i386

debian上可以在/etc/apt/sources.list.d/中新建nginx.list文件
deb http://nginx.org/packages/debian/ codename nginx
deb-src http://nginx.org/packages/debian/ codename nginx

codename是指不同的debian版本号对应不同的codename

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

之后分别运行:
curl http://nginx.org/keys/nginx_signing.key | apt-key add -
apt-get update
apt-get install nginx

还可以编译安装,比较麻烦一些,教程戳这里

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据