在Debian下面通过apt-get可以自动安装 nginx,这样安装的nginx版本都有些旧.
Nginx官网提供了一些编辑绎好的安装包,只需先更新安装源,再通过 apt-get & install 就可安装了。
1.添加安装源
vi /etc/apt/sources.list
根据系统版本添加对应的安装源
#Debian 5.0:
deb http://nginx.org/packages/debian/ lenny nginx
deb-src http://nginx.org/packages/debian/ lenny nginx#Debian 6.0:
deb http://nginx.org/packages/debian/ squeeze nginx
deb-src http://nginx.org/packages/debian/ squeeze nginx#Debian 7.0:
deb http://nginx.org/packages/debian/ wheezy nginx
deb-src http://nginx.org/packages/debian/ wheezy nginx#Debian 8.0:
deb http://nginx.org/packages/debian/ jessie nginx
deb-src http://nginx.org/packages/debian/ jessie nginx#Debian 9.0:
deb http://nginx.org/packages/debian/ stretch nginx
deb-src http://nginx.org/packages/debian/ stretch nginx
2.导入升级Key并更新源
wget http://nginx.org/keys/nginx_signing.key && apt-key add nginx_signing.key
apt-get update
3.安装nginx
apt-get install nginx
Enjoy it!