亲善大使移动 發表於 2019-9-6 23:01:00

Debian 环境安装新版 nginx

<p style="margin: 0 0 20px; text-align: justify; color: rgba(85, 85, 85, 1); text-transform: none; text-indent: 0; letter-spacing: normal; font-family: &quot;Microsoft Yahei&quot;; font-size: 15px; font-style: normal; font-weight: 400; word-spacing: 0; white-space: normal; -ms-word-wrap: break-word; box-sizing: border-box; orphans: 2; widows: 2; background-color: rgba(255, 255, 255, 1); font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial">在 Debian 系统中,我们可以通过 apt-get 安装系统自带的 nginx,这样安装的 nginx 版本略旧。Nginx 官网提供了一些编辑绎好的 deb 安装包,我们只需更新安装源,就可以通过 apt-get 来安装最新的稳定版 Nginx 了。</p>
<p><span style="text-align: justify; color: rgba(85, 85, 85, 1); text-transform: none; text-indent: 0; letter-spacing: normal; font-family: &quot;Microsoft Yahei&quot;; font-size: 15px; font-style: normal; font-weight: 400; word-spacing: 0; white-space: normal; box-sizing: border-box; orphans: 2; widows: 2; background-color: rgba(255, 255, 255, 1); font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial"><span style="text-align: justify; color: rgba(85, 85, 85, 1); text-transform: none; text-indent: 0; letter-spacing: normal; font-family: &quot;Microsoft Yahei&quot;; font-size: 15px; font-style: normal; font-weight: 400; word-spacing: 0; white-space: normal; box-sizing: border-box; orphans: 2; widows: 2; background-color: rgba(255, 255, 255, 1); font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial"><span style="text-align: justify; color: rgba(85, 85, 85, 1); text-transform: none; text-indent: 0; letter-spacing: normal; font-family: &quot;Microsoft Yahei&quot;; font-size: 15px; font-style: normal; font-weight: 400; word-spacing: 0; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgba(255, 255, 255, 1); font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial"><img class="wp-image-2129 lazyload" alt="" data-tag="bdshare" data-src="https://www.debian.cn/wp-content/uploads/2018/04/NGINX.png"></span></span></span></p>
<p style="margin: 0 0 20px; text-align: justify; color: rgba(85, 85, 85, 1); text-transform: none; text-indent: 0; letter-spacing: normal; font-family: &quot;Microsoft Yahei&quot;; font-size: 15px; font-style: normal; font-weight: 400; word-spacing: 0; white-space: normal; -ms-word-wrap: break-word; box-sizing: border-box; orphans: 2; widows: 2; background-color: rgba(255, 255, 255, 1); font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial">&nbsp;<strong>加载安装源并导入key</strong></p>
<pre class="wp-block-preformatted prettyprint"><span class="pln">$ echo deb http<span class="pun">:<span class="com">//nginx.org/packages/debian/ buster nginx | sudo tee /etc/apt/sources.list.d/nginx.list<br>注:主线版本源为 deb http://nginx.org/packages/mainline/debian/ buster nginx<br><span class="pln">$</span>&nbsp;apt install gnupg2<br><span class="pln">$ wget http<span class="pun">:<span class="com">//nginx.org/keys/nginx_signing.key &amp;&amp; sudo apt-key add nginx_signing.key <br><span class="pln">$ sudo apt update <span class="pun">&amp;&amp;<span class="pln"> apt install nginx <span class="pun">-<span class="pln">y</span></span></span></span></span></span></span></span></span></span></span></pre>
<p style="margin: 0 0 20px; text-align: justify; color: rgba(85, 85, 85, 1); text-transform: none; text-indent: 0; letter-spacing: normal; font-family: &quot;Microsoft Yahei&quot;; font-size: 15px; font-style: normal; font-weight: 400; word-spacing: 0; white-space: normal; -ms-word-wrap: break-word; box-sizing: border-box; orphans: 2; widows: 2; background-color: rgba(255, 255, 255, 1); font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial">到这一部分就完成了最新稳定版的 Nginx 的安装。</p>
<p style="margin: 0 0 20px; text-align: justify; color: rgba(85, 85, 85, 1); text-transform: none; text-indent: 0; letter-spacing: normal; font-family: &quot;Microsoft Yahei&quot;; font-size: 15px; font-style: normal; font-weight: 400; word-spacing: 0; white-space: normal; -ms-word-wrap: break-word; box-sizing: border-box; orphans: 2; widows: 2; background-color: rgba(255, 255, 255, 1); font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial">需要注意的是,这一步安装的 Nginx 和系统自带的 nginx 的配置目录略有区别,可以用一下几个简单的命令修正:</p>
<pre class="wp-block-preformatted prettyprint"><span class="pln">sudo mkdir <span class="pun">/<span class="pln">etc<span class="pun">/<span class="pln">nginx<span class="pun">/{<span class="pln">sites<span class="pun">-<span class="pln">available<span class="pun">,<span class="pln">sites<span class="pun">-<span class="pln">enabled<span class="pun">}<br><span class="pln">sudo mv <span class="pun">/<span class="pln">etc<span class="pun">/<span class="pln">nginx<span class="pun">/<span class="pln">conf<span class="pun">.<span class="pln">d<span class="com">/* /etc/nginx/sites-available<br><span class="com">sudo rmdir -f /etc/nginx/conf.d/<br><span class="com">sudo perl -pi -e 's/conf.d/sites-enabled/g' /etc/nginx/nginx.conf</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></pre>
<p>&nbsp;</p><br><br>
来源:https://www.cnblogs.com/surplus/p/11478745.html
頁: [1]
查看完整版本: Debian 环境安装新版 nginx