我們知道,通過 apt-get install nginx 就可以安裝上nginx,可惜這樣安裝的nginx版本都有些舊,就連最新的Debian 8.0 默認安裝的仍然是1.6.2,更別說 Debian 7.0或6.0,那默認安裝都是Nginx1.4.x甚至是Nginx1.2.x
若想要安裝最新的,目前為1.8.0,除了較麻煩的編譯安裝外,還可以繼續選擇包安裝,只需要簡單更新一下庫。
編輯 /etc/apt/sources.list
,添加以下兩行:(注意代號前后都有空格)
deb http://nginx.org/packages/debian/ 版本代號 nginx
deb-src http://nginx.org/packages/debian/ 版本代號 nginx
而Debian版本代號分別為5.0的 lenny,6.0的 squeeze ,7.0的 wheezy 和8.0的 jessie,至于還沒發布的9.0則為 stretch,你只需要根據你使用的版本更換對應的版本代號即可。
例如 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
除了使用VIM編輯器添加之外,還可以使用echo命令導入:
echo deb http://nginx.org/packages/debian/ wheezy nginx >> /etc/apt/sources.list
echo deb-src http://nginx.org/packages/debian/ wheezy nginx >> /etc/apt/sources.list
然后,還需要更新并導入升級Key,否則無法使用;
wget http://nginx.org/keys/nginx_signing.key && apt-key add nginx_signing.key && apt-get update && apt-get install nginx
現在,終于安裝使用上最新的Nginx了。
文/Qoo酷兒(簡書作者)
原文鏈接:http://www.jianshu.com/p/652362f81b21
著作權歸作者所有,轉載請聯系作者獲得授權,并標注“簡書作者”。
@import url(http://www.shnenglu.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
posted on 2016-06-24 09:54
聶文龍 閱讀(127)
評論(0) 編輯 收藏 引用