在Ubuntu 12.04上安装最新的nginx

环境

Ubuntu 12.04是一个操作系统。

安装稳定版本的nginx。

请参考此链接: https://qiita.com/hiroq/items/420424bc500d89fd1cc8

# nginx站点分发的其他PGP密钥
curl http://nginx.org/keys/nginx_signing.key | sudo apt-key add -

# 在列表中添加存储库
VCNAME=`cat /etc/lsb-release | grep DISTRIB_CODENAME | cut -d= -f2` && sudo sh -c "echo \"deb http://nginx.org/packages/ubuntu/ $VCNAME nginx\" >> /etc/apt/sources.list"
VCNAME=`cat /etc/lsb-release | grep DISTRIB_CODENAME | cut -d= -f2` && sudo sh -c "echo \"deb-src http://nginx.org/packages/ubuntu/ $VCNAME nginx\" >> /etc/apt/sources.list"

# 更新后安装 nginx。
sudo apt-get update
sudo apt-get install nginx

# 确认版本
nginx -v
> nginx version: nginx/1.12.0

安装mainline版本的 nginx

参考: https://gist.github.com/craigvantonder/729fc169ae087918e6de744f420adf8b

# nginx站点分发的其他PGP密钥
curl http://nginx.org/keys/nginx_signing.key | sudo apt-key add -

# 在列表中添加存储库
VCNAME=`cat /etc/lsb-release | grep DISTRIB_CODENAME | cut -d= -f2` && sudo sh -c "echo \"deb http://nginx.org/packages/mainline/ubuntu/ $VCNAME nginx\" >> /etc/apt/sources.list"
VCNAME=`cat /etc/lsb-release | grep DISTRIB_CODENAME | cut -d= -f2` && sudo sh -c "echo \"deb-src http://nginx.org/packages/mainline/ubuntu/ $VCNAME nginx\" >> /etc/apt/sources.list"

# 更新后安装 nginx。
sudo apt-get update
sudo apt-get install nginx

# 确认版本
nginx -v
> nginx version: nginx/1.13.0

小贴士: 如何卸载 Nginx

参考: https://askubuntu.com/a/235349

sudo apt-get remove nginx nginx-common # Removes all but config files.
sudo apt-get purge nginx nginx-common # Removes everything.
sudo apt-get autoremove # After using any of the above commands, use this in order to remove dependencies used by nginx which are no longer required.
广告
将在 10 秒后关闭
bannerAds