<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>nginx &#8211; 编码无悔 /  Intent &amp; Focused</title>
	<atom:link href="https://www.codelast.com/tag/nginx/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.codelast.com</link>
	<description>最优化之路</description>
	<lastBuildDate>Mon, 27 Apr 2020 17:57:51 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>[原创] 为nginx服务器网站添加HTTPS／配置SSL证书</title>
		<link>https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e4%b8%banginx%e6%9c%8d%e5%8a%a1%e5%99%a8%e7%bd%91%e7%ab%99%e6%b7%bb%e5%8a%a0https%ef%bc%8f%e9%85%8d%e7%bd%aessl%e8%af%81%e4%b9%a6/</link>
					<comments>https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e4%b8%banginx%e6%9c%8d%e5%8a%a1%e5%99%a8%e7%bd%91%e7%ab%99%e6%b7%bb%e5%8a%a0https%ef%bc%8f%e9%85%8d%e7%bd%aessl%e8%af%81%e4%b9%a6/#comments</comments>
		
		<dc:creator><![CDATA[learnhard]]></dc:creator>
		<pubDate>Sun, 18 Jun 2017 07:10:58 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[原创]]></category>
		<category><![CDATA[综合]]></category>
		<category><![CDATA[https]]></category>
		<category><![CDATA[Let's Encrypt]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[SSL证书]]></category>
		<category><![CDATA[配置]]></category>
		<guid isPermaLink="false">https://www.codelast.com/?p=9305</guid>

					<description><![CDATA[<p>
网站使用HTTPS的好处就不用多说了，在当今凶险的互联网环境下，使用HTTP越来越不安全，所以我也决定把网站转成HTTPS。使用HTTPS，首先你需要有一张SSL证书。<br />
曾经，收费的SSL证书很贵，一般人玩不起；随着互联网的发展，免费的SSL证书越来越普及，谁都可以很容易获取到，所以HTTPS的个人网站也越来越多。<br />
其中，现在最流行的就是使用可靠的数字证书认证机构<a href="https://letsencrypt.org/" rel="noopener noreferrer" target="_blank"><span style="background-color:#ffa07a;">Let&#39;s Encrypt</span></a>提供的免费SSL证书。<br />
<span id="more-9305"></span><br />
下面，我们就来看看，如何一步步把网站变成HTTPS安全链接。<br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="background-color:#00ff00;">『1』</span>使nginx支持SSL<br />
首先你得让你的web server支持SSL。如果你的nginx本来就支持SSL，那就当我没说。如果不支持，请参考<a href="https://www.codelast.com/?p=9285" rel="noopener noreferrer" target="_blank"><span style="background-color:#ffa07a;">这个</span></a>链接。</p>
<p><span style="background-color:#00ff00;">『2』</span>获取及部署SSL证书<br />
为了简化SSL证书的部署，Let&#39;s Encrypt提供了一个叫做<a href="https://certbot.eff.org/" rel="noopener noreferrer" target="_blank"><span style="background-color: rgb(255, 160, 122);">Certbot</span></a>的客户端软件来辅助完成证书部署工作。<br />
首先要安装这个软件，以CentOS系统为例。在Certbot的网站主页上，正确选择web server和OS之后，会跳转到对应的文档章节，指导你怎么做：<br />
<img decoding="async" alt="certbot select web server and os" src="https://www.codelast.com/wp-content/uploads/2017/06/certbot_select_web_server_and_os.png" style="width: 758px; height: 512px;" /><br />
如果你不想看官方文档，也可以参照我下面的方法来操作。<br />
下面是一个例子（不同的web server、不同的OS是不同的，仅供参考）：</p>
<ul>
<li>
		启用<a href="https://fedoraproject.org/wiki/EPEL#How_can_I_use_these_extra_packages.3F" rel="noopener noreferrer" target="_blank"><span style="background-color:#ffa07a;">EPEL</span></a>（Extra Packages for Enterprise Linux）：</li>
</ul>
<section class="output_wrapper" id="output_wrapper_id" style="font-size: 16px; color: rgb(62, 62, 62); line-height: 1.6; letter-spacing: 0px; font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">
<pre style="font-size: inherit; color: inherit; line-height: inherit; margin-top: 0px; margin-bottom: 0px; padding: 0px;">
<code class="bash language-bash hljs" style="margin: 0px 2px; line-height: 18px; font-size: 14px; letter-spacing: 0px; font-family: Consolas, Inconsolata, Courier, monospace; border-radius: 0px; color: rgb(169, 183, 198); background: rgb(40, 43, 46); padding: 0.5em; overflow-wrap: normal !important; word-break: normal !important; overflow: auto !important; display: -webkit-box !important;">yum&#160;install&#160;epel-release
</code></pre>
</section>
<ul>
<li>
		如果你使用的是Amazon Elastic Compute Cloud (Amazon EC2)，那么可以这样做：</li>
</ul>
<section class="output_wrapper" id="output_wrapper_id" style="font-size: 16px; color: rgb(62, 62, 62); line-height: 1.6; letter-spacing: 0px; font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">
<pre style="font-size: inherit; color: inherit; line-height: inherit; margin-top: 0px; margin-bottom: 0px; padding: 0px;">
<code class="bash language-bash hljs" style="margin: 0px 2px; line-height: 18px; font-size: 14px; letter-spacing: 0px; font-family: Consolas, Inconsolata, Courier, monospace; border-radius: 0px; color: rgb(169, 183, 198); background: rgb(40, 43, 46); padding: 0.5em; overflow-wrap: normal !important; word-break: normal !important; overflow: auto !important; display: -webkit-box !important;">yum&#160;-y&#160;install&#160;yum-utils
yum-config-manager&#160;--<span class="hljs-built_in" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(248, 35, 117); word-wrap: inherit !important; word-break: inherit !important;">enable</span>&#160;rhui-REGION-rhel-server-extras&#160;rhui-REGION-rhel-server-optional
</code></pre>
</section>
<ul>
<li>
		安装Certbot：</li>
</ul>
<section class="output_wrapper" id="output_wrapper_id" style="font-size: 16px; color: rgb(62, 62, 62); line-height: 1.6; letter-spacing: 0px; font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">
<pre style="font-size: inherit; color: inherit; line-height: inherit; margin-top: 0px; margin-bottom: 0px; padding: 0px;">
<code class="bash language-bash hljs" style="margin: 0px 2px; line-height: 18px; font-size: 14px; letter-spacing: 0px; font-family: Consolas, Inconsolata, Courier, monospace; border-radius: 0px; color: rgb(169, 183, 198); background: rgb(40, 43, 46); padding: 0.5em; overflow-wrap: normal !important; word-break: normal !important; overflow: auto !important; display: -webkit-box !important;">yum&#160;install&#160;certbot
</code></pre>
</section>
<ul>
<li>
		生成SSL证书：</li>
</ul>
<section class="output_wrapper" id="output_wrapper_id" style="font-size: 16px; color: rgb(62, 62, 62); line-height: 1.6; letter-spacing: 0px; font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">
<pre style="font-size: inherit; color: inherit; line-height: inherit; margin-top: 0px; margin-bottom: 0px; padding: 0px;">
<code class="bash language-bash hljs" style="margin: 0px 2px; line-height: 18px; font-size: 14px; letter-spacing: 0px; font-family: Consolas, Inconsolata, Courier, monospace; border-radius: 0px; color: rgb(169, 183, 198); background: rgb(40, 43, 46); padding: 0.5em; overflow-wrap: normal !important; word-break: normal !important; overflow: auto !important; display: -webkit-box !important;">certbot&#160;certonly&#160;--webroot&#160;-w&#160;/path_to_your_web_root_dir/&#160;-d&#160;codelast.com&#160;-d&#160;www.codelast.com</code></pre>&#8230; <a href="https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e4%b8%banginx%e6%9c%8d%e5%8a%a1%e5%99%a8%e7%bd%91%e7%ab%99%e6%b7%bb%e5%8a%a0https%ef%bc%8f%e9%85%8d%e7%bd%aessl%e8%af%81%e4%b9%a6/" class="read-more">Read More </a></section>]]></description>
										<content:encoded><![CDATA[<p>
网站使用HTTPS的好处就不用多说了，在当今凶险的互联网环境下，使用HTTP越来越不安全，所以我也决定把网站转成HTTPS。使用HTTPS，首先你需要有一张SSL证书。<br />
曾经，收费的SSL证书很贵，一般人玩不起；随着互联网的发展，免费的SSL证书越来越普及，谁都可以很容易获取到，所以HTTPS的个人网站也越来越多。<br />
其中，现在最流行的就是使用可靠的数字证书认证机构<a href="https://letsencrypt.org/" rel="noopener noreferrer" target="_blank"><span style="background-color:#ffa07a;">Let&#39;s Encrypt</span></a>提供的免费SSL证书。<br />
<span id="more-9305"></span><br />
下面，我们就来看看，如何一步步把网站变成HTTPS安全链接。<br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="background-color:#00ff00;">『1』</span>使nginx支持SSL<br />
首先你得让你的web server支持SSL。如果你的nginx本来就支持SSL，那就当我没说。如果不支持，请参考<a href="https://www.codelast.com/?p=9285" rel="noopener noreferrer" target="_blank"><span style="background-color:#ffa07a;">这个</span></a>链接。</p>
<p><span style="background-color:#00ff00;">『2』</span>获取及部署SSL证书<br />
为了简化SSL证书的部署，Let&#39;s Encrypt提供了一个叫做<a href="https://certbot.eff.org/" rel="noopener noreferrer" target="_blank"><span style="background-color: rgb(255, 160, 122);">Certbot</span></a>的客户端软件来辅助完成证书部署工作。<br />
首先要安装这个软件，以CentOS系统为例。在Certbot的网站主页上，正确选择web server和OS之后，会跳转到对应的文档章节，指导你怎么做：<br />
<img decoding="async" alt="certbot select web server and os" src="https://www.codelast.com/wp-content/uploads/2017/06/certbot_select_web_server_and_os.png" style="width: 758px; height: 512px;" /><br />
如果你不想看官方文档，也可以参照我下面的方法来操作。<br />
下面是一个例子（不同的web server、不同的OS是不同的，仅供参考）：</p>
<ul>
<li>
		启用<a href="https://fedoraproject.org/wiki/EPEL#How_can_I_use_these_extra_packages.3F" rel="noopener noreferrer" target="_blank"><span style="background-color:#ffa07a;">EPEL</span></a>（Extra Packages for Enterprise Linux）：</li>
</ul>
<section class="output_wrapper" id="output_wrapper_id" style="font-size: 16px; color: rgb(62, 62, 62); line-height: 1.6; letter-spacing: 0px; font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;">
<pre style="font-size: inherit; color: inherit; line-height: inherit; margin-top: 0px; margin-bottom: 0px; padding: 0px;">
<code class="bash language-bash hljs" style="margin: 0px 2px; line-height: 18px; font-size: 14px; letter-spacing: 0px; font-family: Consolas, Inconsolata, Courier, monospace; border-radius: 0px; color: rgb(169, 183, 198); background: rgb(40, 43, 46); padding: 0.5em; overflow-wrap: normal !important; word-break: normal !important; overflow: auto !important; display: -webkit-box !important;">yum&nbsp;install&nbsp;epel-release
</code></pre>
</section>
<ul>
<li>
		如果你使用的是Amazon Elastic Compute Cloud (Amazon EC2)，那么可以这样做：</li>
</ul>
<section class="output_wrapper" id="output_wrapper_id" style="font-size: 16px; color: rgb(62, 62, 62); line-height: 1.6; letter-spacing: 0px; font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;">
<pre style="font-size: inherit; color: inherit; line-height: inherit; margin-top: 0px; margin-bottom: 0px; padding: 0px;">
<code class="bash language-bash hljs" style="margin: 0px 2px; line-height: 18px; font-size: 14px; letter-spacing: 0px; font-family: Consolas, Inconsolata, Courier, monospace; border-radius: 0px; color: rgb(169, 183, 198); background: rgb(40, 43, 46); padding: 0.5em; overflow-wrap: normal !important; word-break: normal !important; overflow: auto !important; display: -webkit-box !important;">yum&nbsp;-y&nbsp;install&nbsp;yum-utils
yum-config-manager&nbsp;--<span class="hljs-built_in" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(248, 35, 117); word-wrap: inherit !important; word-break: inherit !important;">enable</span>&nbsp;rhui-REGION-rhel-server-extras&nbsp;rhui-REGION-rhel-server-optional
</code></pre>
</section>
<ul>
<li>
		安装Certbot：</li>
</ul>
<section class="output_wrapper" id="output_wrapper_id" style="font-size: 16px; color: rgb(62, 62, 62); line-height: 1.6; letter-spacing: 0px; font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;">
<pre style="font-size: inherit; color: inherit; line-height: inherit; margin-top: 0px; margin-bottom: 0px; padding: 0px;">
<code class="bash language-bash hljs" style="margin: 0px 2px; line-height: 18px; font-size: 14px; letter-spacing: 0px; font-family: Consolas, Inconsolata, Courier, monospace; border-radius: 0px; color: rgb(169, 183, 198); background: rgb(40, 43, 46); padding: 0.5em; overflow-wrap: normal !important; word-break: normal !important; overflow: auto !important; display: -webkit-box !important;">yum&nbsp;install&nbsp;certbot
</code></pre>
</section>
<ul>
<li>
		生成SSL证书：</li>
</ul>
<section class="output_wrapper" id="output_wrapper_id" style="font-size: 16px; color: rgb(62, 62, 62); line-height: 1.6; letter-spacing: 0px; font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;">
<pre style="font-size: inherit; color: inherit; line-height: inherit; margin-top: 0px; margin-bottom: 0px; padding: 0px;">
<code class="bash language-bash hljs" style="margin: 0px 2px; line-height: 18px; font-size: 14px; letter-spacing: 0px; font-family: Consolas, Inconsolata, Courier, monospace; border-radius: 0px; color: rgb(169, 183, 198); background: rgb(40, 43, 46); padding: 0.5em; overflow-wrap: normal !important; word-break: normal !important; overflow: auto !important; display: -webkit-box !important;">certbot&nbsp;certonly&nbsp;--webroot&nbsp;-w&nbsp;/path_to_your_web_root_dir/&nbsp;-d&nbsp;codelast.com&nbsp;-d&nbsp;www.codelast.com
</code></pre>
</section>
<div>
	其中，<span style="color:#0000ff;">path_to_your_web_root_dir</span> 是你的web server的根目录，例如，如果你使用的是WordPress，那么这个目录下就应该有WordPress的index.php等一堆php文件。<br />
	命令执行过程中，会交互式地要你输入紧急联系人的Email，填自己的邮箱即可。</div>
<p><span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="background-color:#00ff00;">『3』</span>配置nginx使得网站可以用https://...访问<br />
在你nginx配置文件 nginx.conf 中的 server {...} 段里，应该有这样一句：</p>
<blockquote>
<p>
		listen 80;</p>
</blockquote>
<p>这是http访问的标准端口，把它改成：</p>
<blockquote>
<p>
		listen 443 ssl;</p>
</blockquote>
<p>使得nginx可以接受https的访问。但同时，我们还要加上下面的配置：</p>
<blockquote>
<div>
		ssl_certificate &nbsp; &nbsp; &nbsp;/etc/letsencrypt/live/codelast.com/fullchain.pem;</div>
<div>
		ssl_certificate_key &nbsp;/etc/letsencrypt/live/codelast.com/privkey.pem;</div>
<div>
		ssl_trusted_certificate /etc/letsencrypt/live/codelast.com/chain.pem;</div>
</blockquote>
<p>这几个路径中的pem文件，就是我们之前用certbot工具生成的。<br />
重启nginx，试验一下是否能用https://...访问网站，浏览器的左上角地址栏里应该有绿色小锁图标：<br />
<img decoding="async" alt="ssl enabled" src="https://www.codelast.com/wp-content/uploads/2017/06/ssl_enabled_codelast.com.png" style="width: 375px; height: 60px;" /><br />
到现在已经是一个巨大的进步了。<br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="background-color:#00ff00;">『4』</span>测试网站的SSL安全性<br />
当你认为&ldquo;似乎&rdquo;一切都已经完成，一切看起来都那么完美之后，你需要使用<a href="https://www.ssllabs.com/ssltest/" rel="noopener noreferrer" target="_blank"><span style="background-color:#ffa07a;">SSL Labs的权威工具</span></a>来测试一下网站的SSL安全性，搞不好结果会令你失望哦。<br />
如下图所示，输入网站域名然后点击&ldquo;Submit&rdquo;就会开始测试：<br />
<img decoding="async" alt="ssl server test" src="https://www.codelast.com/wp-content/uploads/2017/06/ssl_server_test.png" style="width: 841px; height: 366px;" /><br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
测试结果可能会像下面这样：<br />
<img decoding="async" alt="ssl test result rating c" src="https://www.codelast.com/wp-content/uploads/2017/06/ssl_test_result_rating_c.png" style="width: 990px; height: 398px;" /><br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
SSL安全性得分是C，这是个非常糟糕的分数，它表明我配置的SSL server很不安全！所以需要按照测试结果下方给出的建议来进行修改。从标红的文字知道，得分为C的原因是我没有禁用SSL 3.0协议。为什么要禁用？因为SSLv3已经被发现有严重的安全漏洞，所以不应该再让web server支持它。</p>
<p><span style="background-color:#00ff00;">『5』</span>禁用SSLv3<br />
在nginx配置文件的 server {...} 段中，添加下面这句，使得nginx只支持TLS协议：</p>
<blockquote>
<p>
		ssl_protocols TLSv1 TLSv1.1 TLSv1.2;</p>
</blockquote>
<p>这样，重启nginx之后SSLv3就被禁用了。再次运行SSL Labs的测试，会发现安全性评分提高到了B：<br />
<img decoding="async" alt="ssl test result rating b" src="https://www.codelast.com/wp-content/uploads/2017/06/ssl_test_result_rating_b.png" style="width: 957px; height: 357px;" /><br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="background-color:#00ff00;">『6』</span>配置前向安全性和DHE（Diffie Hellman Ephemeral）<br />
分数B还是比较&ldquo;惨&rdquo;的，正如&ldquo;Grade capped to B&rdquo;那一句高亮的话所提示的，我的SSL server现在还有DH key交换的安全问题，关于这个问题的详细解释，可以参考<a href="https://linux.cn/article-5374-1.html#3_15413" rel="noopener noreferrer" target="_blank"><span style="background-color:#ffa07a;">这个</span></a>或<a href="https://weakdh.org/" rel="noopener noreferrer" target="_blank"><span style="background-color:#ffa07a;">这个</span></a>链接。<br />
解决步骤如下：<br />
使用openssl命令生成一个强壮的DH组（前提是你已经安装了openssl软件）：</p>
<section class="output_wrapper" id="output_wrapper_id" style="font-size: 16px; color: rgb(62, 62, 62); line-height: 1.6; letter-spacing: 0px; font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;">
<pre style="font-size: inherit; color: inherit; line-height: inherit; margin-top: 0px; margin-bottom: 0px; padding: 0px;">
<code class="bash language-bash hljs" style="margin: 0px 2px; line-height: 18px; font-size: 14px; letter-spacing: 0px; font-family: Consolas, Inconsolata, Courier, monospace; border-radius: 0px; color: rgb(169, 183, 198); background: rgb(40, 43, 46); padding: 0.5em; overflow-wrap: normal !important; word-break: normal !important; overflow: auto !important; display: -webkit-box !important;">openssl&nbsp;dhparam&nbsp;-out&nbsp;dhparams.pem&nbsp;2048
</code></pre>
</section>
<div>
	命令执行后，命令行会打印出如下信息：</div>
<blockquote>
<div>
		Generating DH parameters, 2048 bit long safe prime, generator 2</div>
<div>
		This is going to take a long time</div>
</blockquote>
<div>
	正如这句话所描述的，经过漫长的等待结束之后，会在当前目录下生成一个 dhparams.pem 文件。</div>
<p>然后我把这个文件移到&nbsp;/etc/ssl/certs/ 目录下（其实你放哪里都可以）：</p>
<section class="output_wrapper" id="output_wrapper_id" style="font-size: 16px; color: rgb(62, 62, 62); line-height: 1.6; letter-spacing: 0px; font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;">
<pre style="font-size: inherit; color: inherit; line-height: inherit; margin-top: 0px; margin-bottom: 0px; padding: 0px;">
<code class="bash language-bash hljs" style="margin: 0px 2px; line-height: 18px; font-size: 14px; letter-spacing: 0px; font-family: Consolas, Inconsolata, Courier, monospace; border-radius: 0px; color: rgb(169, 183, 198); background: rgb(40, 43, 46); padding: 0.5em; overflow-wrap: normal !important; word-break: normal !important; overflow: auto !important; display: -webkit-box !important;">mv&nbsp;dhparams.pem&nbsp;/etc/ssl/certs/
</code></pre>
</section>
<p>最后在nginx中的 server {...} 段中添加这么几句配置：</p>
<blockquote>
<div>
		ssl_dhparam /etc/ssl/certs/dhparams.pem;</div>
<div>
		ssl_ciphers &#39;ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA&#39;;</div>
<div>
		ssl_prefer_server_ciphers on;</div>
</blockquote>
<p>然后再重启nginx，此问题就解决了。再次运行SSL Labs的测试，会发现安全性评分提高到了令人欣慰的A：<br />
<img decoding="async" alt="ssl test result rating a" src="https://www.codelast.com/wp-content/uploads/2017/06/ssl_test_result_rating_a.png" style="width: 992px; height: 377px;" /><br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="background-color: rgb(0, 255, 0);">『7』</span>兼容原有的HTTP访问<br />
经过上面的配置，我们已经可以用 https://... 来访问网站，并且网站的SSL安全性也比较高了，但是，网站的老用户可能并不知道我们使用了安全链接，他们仍然会使用 http://... 来访问网站，所以要保证用户使用这个链接访问网站的时候，会自动跳转到 https://... 网址，从而使用安全链接。<br />
nginx配置方法是，在 http {...} 段中添加一个独立的 server {...} 块，如下：</p>
<blockquote>
<div>
		server {</div>
<div>
		&nbsp; listen 80;</div>
<div>
		&nbsp; server_name codelast.com www.codelast.com;</div>
<div>
		&nbsp; return 301 https://$server_name$request_uri;</div>
<div>
		}</div>
</blockquote>
<p>重启nginx之后，试一下用 http://... 来访问网站，应该就能自动跳转到 https://... 的对应链接了。<br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="background-color:#00ff00;">『8』</span>配置HSTS（HTTP严格传输安全，HTTP Strict Transport Security），进一步提高安全性<br />
事实上，前面的nginx配置还有一个安全性漏洞，填补上之后，评分A还可以进一步提高为A+！<br />
这个配置就是所谓的<a href="https://zh.wikipedia.org/wiki/HTTP%E4%B8%A5%E6%A0%BC%E4%BC%A0%E8%BE%93%E5%AE%89%E5%85%A8" rel="noopener noreferrer" target="_blank"><span style="background-color:#ffa07a;">HSTS</span></a>。</p>
<blockquote>
<p>
		HTTP严格传输安全（英语：HTTP Strict Transport Security，缩写：HSTS）是一套由互联网工程任务组发布的互联网安全策略机制。网站可以选择使用HSTS策略，来让浏览器强制使用HTTPS与网站进行通信，以减少会话劫持风险。</p>
</blockquote>
<p>不启用HSTS的潜在问题，也可以参考<a href="https://linux.cn/article-5266-1.html#3_609" rel="noopener noreferrer" target="_blank"><span style="background-color:#ffa07a;">这个</span></a>链接。<br />
nginx开启HSTS的方法是，在SSL相关的 server {...} 段中添加这么一句话：</p>
<blockquote>
<p>
		add_header Strict-Transport-Security &quot;max-age=31536000;includeSubDomains&quot;;</p>
</blockquote>
<p>然后重启nginx，再次运行SSL Labs的测试，会发现安全性评分终于达到了A+：<br />
<img decoding="async" alt="ssl test result rating a plus" src="https://www.codelast.com/wp-content/uploads/2017/06/ssl_test_result_rating_a_plus.png" style="width: 990px; height: 414px;" /></p>
<p>图下方那句绿色高亮的信息表示我已经启用了HSTS。<br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="background-color: rgb(0, 255, 0);">『9』</span>自动更新证书<br />
<a href="https://letsencrypt.org/" rel="noopener noreferrer" target="_blank"><span style="background-color: rgb(255, 160, 122);">Let&#39;s Encrypt</span></a>提供的免费SSL证书只有90天的有效期，过期之后，如果你不更新证书，那么访问网站的时候，浏览器就会提示证书的安全问题，如果发生这种情况，会对访客造成极大的困扰。<br />
Certbot提供了非常简便的自动更新证书功能，我们只需要执行1个命令，就可以完成证书的更新，所以，把这个命令加入crontab中自动执行，我们就不用担心证书过期问题啦。<br />
测试自动更新证书（实际上并不会更新，只是测试）：</p>
<section class="output_wrapper" id="output_wrapper_id" style="font-size: 16px; color: rgb(62, 62, 62); line-height: 1.6; letter-spacing: 0px; font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;">
<pre style="font-size: inherit; color: inherit; line-height: inherit; margin-top: 0px; margin-bottom: 0px; padding: 0px;">
<code class="bash language-bash hljs" style="margin: 0px 2px; line-height: 18px; font-size: 14px; letter-spacing: 0px; font-family: Consolas, Inconsolata, Courier, monospace; border-radius: 0px; color: rgb(169, 183, 198); background: rgb(40, 43, 46); padding: 0.5em; overflow-wrap: normal !important; word-break: normal !important; overflow: auto !important; display: -webkit-box !important;">certbot&nbsp;renew&nbsp;--dry-run
</code></pre>
</section>
<p>如果你看到打印出类似于这样一句话：</p>
<blockquote>
<p>
		Congratulations, all renewals succeeded. The following certs have been renewed:</p>
</blockquote>
<p>那就说明测试成功了。下面，你需要做的就是把这个命令加入crontab，让其周期性执行：</p>
<section class="output_wrapper" id="output_wrapper_id" style="font-size: 16px; color: rgb(62, 62, 62); line-height: 1.6; letter-spacing: 0px; font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;">
<pre style="font-size: inherit; color: inherit; line-height: inherit; margin-top: 0px; margin-bottom: 0px; padding: 0px;">
<code class="bash language-bash hljs" style="margin: 0px 2px; line-height: 18px; font-size: 14px; letter-spacing: 0px; font-family: Consolas, Inconsolata, Courier, monospace; border-radius: 0px; color: rgb(169, 183, 198); background: rgb(40, 43, 46); padding: 0.5em; overflow-wrap: normal !important; word-break: normal !important; overflow: auto !important; display: -webkit-box !important;">certbot&nbsp;renew
</code></pre>
</section>
<p>这个命令的作用是更新证书（不是测试），但是在你的证书到期之前，它并不会产生什么实际的效果。为了保险，Certbot建议每天运行这个命令两次，所以我在我的 /etc/crontab 中添加了下面这几句配置：</p>
<blockquote>
<div>
		# renew Cetbot SSL certificate</div>
<div>
		59 23 * * * root certbot renew</div>
<div>
		59 11 * * * root certbot renew</div>
</blockquote>
<p>它表示在每天的23:59和11:59时会执行证书更新命令。这样就可以高枕无忧了。<br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="background-color:#00ff00;"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/25b6.png" alt="▶" class="wp-smiley" style="height: 1em; max-height: 1em;" /><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/25b6.png" alt="▶" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span>&nbsp;更新<br />
2020.02.01：收到<span style="color:#0000ff;">Let&#39;s Encrypt</span>官方邮件，通知说<span style="color:#0000ff;">certbot</span>程序必须要更新到最新版，否则到2020.06.01就不能用了，于是用 <span style="color:#a52a2a;">yum install certbot</span>&nbsp;命令来更新它，更新之后再用&nbsp;<span style="color:#b22222;">certbot renew --dry-run</span>&nbsp;命令来测试一下，如果打印出成功的提示，就说明更新没有问题了。</p>
<p><span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;版权声明&nbsp;<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;<br />
转载需注明出处：<u><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><em><span style="color: rgb(0, 0, 255);"><strong style="font-size: 16px;"><span style="font-family: arial, helvetica, sans-serif;">codelast.com</span></strong></span></em></a></u>&nbsp;<br />
感谢关注我的微信公众号（微信扫一扫）：</p>
<p style="border: 0px; font-size: 13px; margin: 0px 0px 9px; outline: 0px; padding: 0px; color: rgb(77, 77, 77);">
	<img decoding="async" alt="wechat qrcode of codelast" src="https://www.codelast.com/codelast_wechat_qr_code.jpg" style="width: 200px; height: 200px;" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e4%b8%banginx%e6%9c%8d%e5%8a%a1%e5%99%a8%e7%bd%91%e7%ab%99%e6%b7%bb%e5%8a%a0https%ef%bc%8f%e9%85%8d%e7%bd%aessl%e8%af%81%e4%b9%a6/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>[原创] 为nginx添加SSL支持模块</title>
		<link>https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e4%b8%banginx%e6%b7%bb%e5%8a%a0ssl%e6%94%af%e6%8c%81%e6%a8%a1%e5%9d%97/</link>
					<comments>https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e4%b8%banginx%e6%b7%bb%e5%8a%a0ssl%e6%94%af%e6%8c%81%e6%a8%a1%e5%9d%97/#respond</comments>
		
		<dc:creator><![CDATA[learnhard]]></dc:creator>
		<pubDate>Mon, 12 Jun 2017 04:32:20 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[原创]]></category>
		<category><![CDATA[综合]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[SSL模块]]></category>
		<guid isPermaLink="false">https://www.codelast.com/?p=9285</guid>

					<description><![CDATA[<p>
因为网站要加SSL证书的原因，把nginx折腾了一番，结果SSL相关的配置加到了nginx的配置文件中后，nginx竟然启动不起来了，用 <span style="color:#0000ff;">systemctl status nginx</span> 查看到的错误信息大致如下：</p>
<blockquote>
<p>
		Failed to start SYSV: Nginx is an HTTP(S) server, HTTP(S) reverse ...</p>
</blockquote>
<p>于是用如下命令测试问题所在：</p>
<blockquote>
<p>
		/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf</p>
</blockquote>
<p>其中，/usr/local/nginx/sbin/nginx 是我的nginx安装后的可执行程序路径，/usr/local/nginx/conf/nginx.conf 是我的nginx主配置文件路径。<br />
<span id="more-9285"></span><br />
该命令输出如下：</p>
<blockquote>
<div>
		nginx: [emerg] the &#34;ssl&#34; parameter requires ngx_http_ssl_module in /usr/local/nginx/conf/nginx.conf:41</div>
</blockquote>
<div>
	可见，nginx缺少SSL模块支持。这是因为我当年建站的时候根本没用到SSL啊，所以以前编译nginx的时候使用了不带SSL支持的默认编译参数。<br />
	为了让nginx添加SSL模块，只能重新编译它。但是，如何在现有nginx的基础上，添加一个支持SSL的编译参数呢？首先要找回原来编译nginx时的编译参数，然后再加上支持SSL的编译参数。如果不这样做，那么编译出来的nginx可能就会有问题（某些旧的编译参数被去掉了，使得nginx不能支持某些功能）。<br />
	<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="http://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">http://www.codelast.com/</span></a><br />
	所以先查看旧的nginx的编译参数：
<section class="output_wrapper" id="output_wrapper_id" style="font-size: 16px; color: rgb(62, 62, 62); line-height: 1.6; letter-spacing: 0px; font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">
<pre style="font-size: inherit; color: inherit; line-height: inherit; margin-top: 0px; margin-bottom: 0px; padding: 0px;">
<code class="bash language-bash hljs" style="margin: 0px 2px; line-height: 18px; font-size: 14px; letter-spacing: 0px; font-family: Consolas, Inconsolata, Courier, monospace; border-radius: 0px; color: rgb(169, 183, 198); background: rgb(40, 43, 46); padding: 0.5em; overflow-wrap: normal !important; word-break: normal !important; overflow: auto !important; display: -webkit-box !important;">/usr/<span class="hljs-built_in" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(248, 35, 117); word-wrap: inherit !important; word-break: inherit !important;">local</span>/nginx/sbin/nginx&#160;-V
</code></pre>
</section>
<p>输出的信息中，最重要的一句是：</p></div>
<blockquote>
<div>
		configure arguments: --prefix=/usr/local/nginx</div>
</blockquote>
<div>
	可见，当时我编译nginx的时候，只是指定了一个安装路径，没有其他特殊的编译参数。那么现在事情就好办了：回到nginx的源码目录下，加上SSL支持参数重新编译：
<section class="output_wrapper" id="output_wrapper_id" style="font-size: 16px; color: rgb(62, 62, 62); line-height: 1.6; letter-spacing: 0px; font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">
<pre style="font-size: inherit; color: inherit; line-height: inherit; margin-top: 0px; margin-bottom: 0px; padding: 0px;">
<code class="bash language-bash hljs" style="margin: 0px 2px; line-height: 18px; font-size: 14px; letter-spacing: 0px; font-family: Consolas, Inconsolata, Courier, monospace; border-radius: 0px; color: rgb(169, 183, 198); background: rgb(40, 43, 46); padding: 0.5em; overflow-wrap: normal !important; word-break: normal !important; overflow: auto !important; display: -webkit-box !important;">./configure&#160;--prefix=/usr/</code></pre></section></div>&#8230; <a href="https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e4%b8%banginx%e6%b7%bb%e5%8a%a0ssl%e6%94%af%e6%8c%81%e6%a8%a1%e5%9d%97/" class="read-more">Read More </a>]]></description>
										<content:encoded><![CDATA[<p>
因为网站要加SSL证书的原因，把nginx折腾了一番，结果SSL相关的配置加到了nginx的配置文件中后，nginx竟然启动不起来了，用 <span style="color:#0000ff;">systemctl status nginx</span> 查看到的错误信息大致如下：</p>
<blockquote>
<p>
		Failed to start SYSV: Nginx is an HTTP(S) server, HTTP(S) reverse ...</p>
</blockquote>
<p>于是用如下命令测试问题所在：</p>
<blockquote>
<p>
		/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf</p>
</blockquote>
<p>其中，/usr/local/nginx/sbin/nginx 是我的nginx安装后的可执行程序路径，/usr/local/nginx/conf/nginx.conf 是我的nginx主配置文件路径。<br />
<span id="more-9285"></span><br />
该命令输出如下：</p>
<blockquote>
<div>
		nginx: [emerg] the &quot;ssl&quot; parameter requires ngx_http_ssl_module in /usr/local/nginx/conf/nginx.conf:41</div>
</blockquote>
<div>
	可见，nginx缺少SSL模块支持。这是因为我当年建站的时候根本没用到SSL啊，所以以前编译nginx的时候使用了不带SSL支持的默认编译参数。<br />
	为了让nginx添加SSL模块，只能重新编译它。但是，如何在现有nginx的基础上，添加一个支持SSL的编译参数呢？首先要找回原来编译nginx时的编译参数，然后再加上支持SSL的编译参数。如果不这样做，那么编译出来的nginx可能就会有问题（某些旧的编译参数被去掉了，使得nginx不能支持某些功能）。<br />
	<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="http://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">http://www.codelast.com/</span></a><br />
	所以先查看旧的nginx的编译参数：</p>
<section class="output_wrapper" id="output_wrapper_id" style="font-size: 16px; color: rgb(62, 62, 62); line-height: 1.6; letter-spacing: 0px; font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;">
<pre style="font-size: inherit; color: inherit; line-height: inherit; margin-top: 0px; margin-bottom: 0px; padding: 0px;">
<code class="bash language-bash hljs" style="margin: 0px 2px; line-height: 18px; font-size: 14px; letter-spacing: 0px; font-family: Consolas, Inconsolata, Courier, monospace; border-radius: 0px; color: rgb(169, 183, 198); background: rgb(40, 43, 46); padding: 0.5em; overflow-wrap: normal !important; word-break: normal !important; overflow: auto !important; display: -webkit-box !important;">/usr/<span class="hljs-built_in" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(248, 35, 117); word-wrap: inherit !important; word-break: inherit !important;">local</span>/nginx/sbin/nginx&nbsp;-V
</code></pre>
</section>
<p>输出的信息中，最重要的一句是：</p></div>
<blockquote>
<div>
		configure arguments: --prefix=/usr/local/nginx</div>
</blockquote>
<div>
	可见，当时我编译nginx的时候，只是指定了一个安装路径，没有其他特殊的编译参数。那么现在事情就好办了：回到nginx的源码目录下，加上SSL支持参数重新编译：</p>
<section class="output_wrapper" id="output_wrapper_id" style="font-size: 16px; color: rgb(62, 62, 62); line-height: 1.6; letter-spacing: 0px; font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;">
<pre style="font-size: inherit; color: inherit; line-height: inherit; margin-top: 0px; margin-bottom: 0px; padding: 0px;">
<code class="bash language-bash hljs" style="margin: 0px 2px; line-height: 18px; font-size: 14px; letter-spacing: 0px; font-family: Consolas, Inconsolata, Courier, monospace; border-radius: 0px; color: rgb(169, 183, 198); background: rgb(40, 43, 46); padding: 0.5em; overflow-wrap: normal !important; word-break: normal !important; overflow: auto !important; display: -webkit-box !important;">./configure&nbsp;--prefix=/usr/<span class="hljs-built_in" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(248, 35, 117); word-wrap: inherit !important; word-break: inherit !important;">local</span>/nginx&nbsp;--with-http_ssl_module
make
</code></pre>
</section>
<p><span id="docs-internal-guid-a0001a48-9a82-942a-4ea2-e8bd8bba5160"><span style="font-size: 11pt; font-family: Arial; vertical-align: baseline; white-space: pre-wrap;"><span style="color:#ff0000;">注意，此时千万不能手快直接 make install</span>！因为我原来的nginx还有一堆的配置文件，不能被覆盖。我们应该只覆盖编译出来的nginx可执行程序：</span></span></p>
<section class="output_wrapper" id="output_wrapper_id" style="font-size: 16px; color: rgb(62, 62, 62); line-height: 1.6; letter-spacing: 0px; font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;">
<pre style="font-size: inherit; color: inherit; line-height: inherit; margin-top: 0px; margin-bottom: 0px; padding: 0px;">
<code class="bash language-bash hljs" style="margin: 0px 2px; line-height: 18px; font-size: 14px; letter-spacing: 0px; font-family: Consolas, Inconsolata, Courier, monospace; border-radius: 0px; color: rgb(169, 183, 198); background: rgb(40, 43, 46); padding: 0.5em; overflow-wrap: normal !important; word-break: normal !important; overflow: auto !important; display: -webkit-box !important;">cp&nbsp;/usr/<span class="hljs-built_in" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(248, 35, 117); word-wrap: inherit !important; word-break: inherit !important;">local</span>/nginx/sbin/nginx&nbsp;~/
cp&nbsp;objs/nginx&nbsp;/usr/<span class="hljs-built_in" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(248, 35, 117); word-wrap: inherit !important; word-break: inherit !important;">local</span>/nginx/sbin/
</code></pre>
</section>
<p><span id="docs-internal-guid-a0001a48-9a82-942a-4ea2-e8bd8bba5160"><span style="font-size: 11pt; font-family: Arial; vertical-align: baseline; white-space: pre-wrap;">其中，objs/nginx 是新编译出来的nginx可执行程序。</span></span><br />
	<span id="docs-internal-guid-a0001a48-9a82-942a-4ea2-e8bd8bba5160"><span style="font-size: 11pt; font-family: Arial; vertical-align: baseline; white-space: pre-wrap;">覆盖之后，再尝试重新启动nginx，就没有问题了。</p>
<p>	<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
	<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;版权声明&nbsp;<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;<br />
	转载需注明出处：<u><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><em><span style="color: rgb(0, 0, 255);"><strong style="font-size: 16px;"><span style="font-family: arial, helvetica, sans-serif;">codelast.com</span></strong></span></em></a></u>&nbsp;<br />
	感谢关注我的微信公众号（微信扫一扫）：</span></span></p>
<p style="border: 0px; font-size: 13px; margin: 0px 0px 9px; outline: 0px; padding: 0px; color: rgb(77, 77, 77);">
		<span id="docs-internal-guid-a0001a48-9a82-942a-4ea2-e8bd8bba5160"><span style="font-size: 11pt; font-family: Arial; vertical-align: baseline; white-space: pre-wrap;"><img decoding="async" alt="wechat qrcode of codelast" src="https://www.codelast.com/codelast_wechat_qr_code.jpg" style="width: 200px; height: 200px;" /></span></span></p>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e4%b8%banginx%e6%b7%bb%e5%8a%a0ssl%e6%94%af%e6%8c%81%e6%a8%a1%e5%9d%97/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
