Skip to content

Instantly share code, notes, and snippets.

@wvv8oo
Created February 11, 2015 02:56
Show Gist options
  • Save wvv8oo/27beae9d47a06bf52653 to your computer and use it in GitHub Desktop.
Save wvv8oo/27beae9d47a06bf52653 to your computer and use it in GitHub Desktop.
Debian/Ubuntu上用apt-get安装最新版本的nginx
1、首先我们要把nginx的apt源加入/etc/apt/sources.list:
Debian 6(squeeze):
deb http://nginx.org/packages/debian/ squeeze nginx
deb-src http://nginx.org/packages/debian/ squeeze nginx
如果是Debian 5,则将上面的squeeze改成lenny即可。
Ubuntu 12.04 LTS(precise):
deb http://nginx.org/packages/ubuntu/ precise nginx
deb-src http://nginx.org/packages/ubuntu/ precise nginx
2、更新apt-key:
wget http://nginx.org/keys/nginx_signing.key
sudo apt-key add nginx_signing.key
如果不执行这一步,执行以下步骤时会出现类似这样的错误:
GPG error: http://nginx.org precise Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY ABF5BD827BD9BF62
3、更新apt
apt-get update
4、安装nginx
apt-get install nginx
如果出现错误提示 /etc/logrotate.d/nginx 和这个相关,则先执行:
apt-get remove nginx-common
然后再执行apt-get install nginx
期间会有提示你是否更新配置文件,回答Y即可
5、安装完毕,执行
/usr/sbin/nginx -v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment