1.首先要把nginx的apt源加入到/etc/apt/source.list中去
Debian7 (wheezy)
deb http://nginx.org/packages/debian/ wheezy nginxdeb-src http://nginx.org/packages/debian/ wheezy nginx
如果是Debian5的话,则将上面的wheezy更换成对应的代号即可(lenny),Debian6 (squeeze)
2.更新apt-key
wget http://nginx.org/keys/nginx_signing.keysudo 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
5.安装完成,查看版本号:
/usr/sbin/nginx -v
参考地址:http://www.asklinux.com/linux/debian/78