<?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>https &#8211; 記下來</title>
	<atom:link href="https://noter.tw/tag/https/feed/" rel="self" type="application/rss+xml" />
	<link>https://noter.tw</link>
	<description>一路上踩到的坑、遇到的問題，一點一滴記下來，希望能幫助到需要的人~</description>
	<lastBuildDate>Tue, 21 May 2024 02:10:18 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.6.3</generator>

<image>
	<url>https://noter.tw/wp-content/uploads/cropped-old-1130742_1920-1-32x32.jpg</url>
	<title>https &#8211; 記下來</title>
	<link>https://noter.tw</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>向 TWCA 申請 SSL 憑證 (Ubuntu, Apache)</title>
		<link>https://noter.tw/10420/%e5%90%91-twca-%e7%94%b3%e8%ab%8b-ssl-%e6%86%91%e8%ad%89-ubuntu-apache/</link>
					<comments>https://noter.tw/10420/%e5%90%91-twca-%e7%94%b3%e8%ab%8b-ssl-%e6%86%91%e8%ad%89-ubuntu-apache/#respond</comments>
		
		<dc:creator><![CDATA[黃小蛙]]></dc:creator>
		<pubDate>Fri, 07 Oct 2022 12:43:49 +0000</pubDate>
				<category><![CDATA[Web Server]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[TWCA 憑證]]></category>
		<category><![CDATA[TWCA SSL Apache]]></category>
		<category><![CDATA[Ubuntu Apache SSL]]></category>
		<category><![CDATA[TWCA CSR]]></category>
		<category><![CDATA[TWCA CER]]></category>
		<category><![CDATA[產生 TWCA CSR]]></category>
		<category><![CDATA[https]]></category>
		<category><![CDATA[Private Key]]></category>
		<category><![CDATA[ssl]]></category>
		<category><![CDATA[如何生成 CSR]]></category>
		<category><![CDATA[TWCA]]></category>
		<category><![CDATA[如何生成 private key]]></category>
		<category><![CDATA[SSL 憑證申請]]></category>
		<category><![CDATA[CSR]]></category>
		<category><![CDATA[TWCA 憑證申請教學]]></category>
		<guid isPermaLink="false">https://noter.tw/?p=10420</guid>

					<description><![CDATA[<p>因為某些特殊緣故必須要向 TWCA (臺灣網路認證) 申請 SSL 憑證，已經申請好幾次了，每次做都還要去查資料，這篇文章把向 TWCA 申請 SSL 憑證的流程記下來。</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/10420/%e5%90%91-twca-%e7%94%b3%e8%ab%8b-ssl-%e6%86%91%e8%ad%89-ubuntu-apache/" data-wpel-link="internal">向 TWCA 申請 SSL 憑證 (Ubuntu, Apache)</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>因為某些特殊緣故必須要向 <a href="https://www.twca.com.tw/" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right">TWCA<span class="wpel-icon wpel-image wpel-icon-6"></span></a> (臺灣網路認證) 申請 SSL 憑證，已經申請好幾次了，每次做都還要去查資料，這篇文章把向 TWCA 申請 SSL 憑證的流程記下來。</p>



<span id="more-10420"></span>



<p><a href="https://www.twca.com.tw/service_detail/7d08f851-9415-4dd7-92cc-91ee37fb7b69" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right">TWCA 官網<span class="wpel-icon wpel-image wpel-icon-6"></span></a>列出申請 SSL 憑證總共有 6 個步驟，接下來小蛙會著重在第 3 步：<strong>上傳 CSR (WEB)</strong> 以及第 6 步：<strong>安裝與設定 1.電子憑證 2.認證標章</strong> (但不會使用認證標章)</p>



<h2 class="wp-block-heading para">申請 TWCA SSL 憑證：上傳 CSR (WEB)</h2>



<h3 class="wp-block-heading para">產生主機 KEY 及 CSR 憑證請求檔</h3>



<p>首先進到 /etc/ssl/ 產生金鑰 (private key)</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">cd /etc/ssl/
openssl genrsa -out server.key 2048</pre>



<p>使用這把金鑰產生 CSR 憑證請求檔</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">openssl req -new -key ./server.key -out server.csr

You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]: TW (國家縮寫)
State or Province Name (full name) [Some-State]:Taiwan (國家名稱全名)
Locality Name (eg, city) []:Taichung (城市名稱)
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Noter (公司名稱) 
Organizational Unit Name (eg, section) []:IT (部門名稱)
Common Name (e.g. server FQDN or YOUR name) []:noter.tw (網域名稱)
Email Address []:noter.tw@gmail.com (電子郵件)

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:Noter (選用的公司名稱)</pre>



<p>2024-05-21 補充，因為每年都要產生一次，有時候忘記 CSR 要輸入的東西，就可以使用以下指令來看查看之前產生 CSR 時填入的資訊</p>



<pre class="EnlighterJSRAW" data-enlighter-language="bash" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">openssl req -in example.csr -noout -text</pre>



<h3 class="wp-block-heading para">上傳 CSR</h3>



<p>經過上述步驟後，在 <code>/etc/ssl/</code> 下會多出 <code>server.key</code> 及 <code>server.csr</code>，回到 <a href="https://www.twca.com.tw/service_detail/7d08f851-9415-4dd7-92cc-91ee37fb7b69" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right">TWCA 官網<span class="wpel-icon wpel-image wpel-icon-6"></span></a> 第 3 點的描述</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>請將CSR檔案中的內容複製到下方的空欄中，注意複製的範圍應包括「&#8212;&#8211;BEGIN NEW CERTIFICATE REQUEST&#8212;&#8211;」到「&#8212;&#8211;END NEW CERTIFICATE REQUEST&#8212;&#8211;」的宣告文字。</p>
</blockquote>



<p>透過 cat 印出剛剛產生的 CSR</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">cat server.csr

-----BEGIN CERTIFICATE REQUEST-----
...
...
...
-----END CERTIFICATE REQUEST-----</pre>



<p>複製「&#8212;&#8211;BEGIN NEW CERTIFICATE REQUEST&#8212;&#8211;」到「&#8212;&#8211;END NEW CERTIFICATE REQUEST&#8212;&#8211;」範圍的文字，貼到 TWCA 官網中點擊繼續</p>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEUii6S1K0_-GAxZTQ4PT-RTlxjCuLFkpe0VAvFwfpE3q-pmUMS82NLzMZ2EFsIqYzIdmvBthfhNlrBwzdp4ZaPJ_-EO8dD-UrJXL9i3N8OVr6_0InU84JukzuF3U7-NRe6klxRdVJmd6_Im7_qySb_5=w1045-h542-no?authuser=1" alt="TWCA SSL 憑證：上傳 CSR 1" style="width:784px;height:407px" title="向 TWCA 申請 SSL 憑證 (Ubuntu, Apache)"></figure></div>


<p>確認紅框內的資訊後，輸入密碼、選擇驗證網域的方式、及表單編號</p>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEUqolhtYlj23TU_asHRoGOkYyLZmY0q1f9IvsjnYS55DsJ6EXJ_g8Id2rfakMgph2jwTvRMeYCobOnt9aFObIzIpfaXtEzkp4FkCwmmLJGGqe2-1o80Rk97cSPzuNNHBsDYtGfHbNsTAObyCkZbefFI=w1108-h1023-no?authuser=1" alt="TWCA SSL 憑證：上傳 CSR 2" title="向 TWCA 申請 SSL 憑證 (Ubuntu, Apache)"></figure></div>


<p>點擊繼續後即上傳完成</p>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEXQAtelMnZH8S-ITRuLhOr_yzNo6nLJJxRRNiIJO5kY_QpojlFzhT28LG7o6d86OqZO_3UsYZhqy6zzmF-VaMOpcD8rSz11S1rDIGYbdjthRH0dahHm_3d5MOAOdGERglUcxgj85jDs9raoXsL5OK2p=w684-h245-no?authuser=1" alt="TWCA SSL 憑證：上傳 CSR 3" style="width:513px;height:184px" title="向 TWCA 申請 SSL 憑證 (Ubuntu, Apache)"></figure></div>


<h3 class="wp-block-heading para">驗證網域所有權</h3>



<p>小蛙這邊使用的是「網站檔案驗證」(上一步選擇的)，收到操作手冊與驗證檔</p>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEX4VoKr55HSOfIw9uQM_tnFTnwFi66y-mKKKeoMZ7nGDLhSXbn-W7-zYebDhdnOroC_NaWLwg2WgTPrSsC1szr1c3FyAi8pKZpzme3eZ4uCcSxXKtgjjb28m3z-pcRDHLxPsMiJkWQL8fb62ziSOZEi=w944-h664-no?authuser=1" alt="TWCA SSL 憑證：驗證網域" style="width:708px;height:498px" title="向 TWCA 申請 SSL 憑證 (Ubuntu, Apache)"></figure></div>


<p>在網站根目錄建立對應的資料夾及 <code>whois.txt</code> 檔案，並將 email 附件中的 whois.txt 貼上，也可以直接把附件中的檔案解壓縮後，直接上傳到網站根目錄中。例如小蛙的網站根目錄是 <code>/var/www/html/</code> </p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">mkdir -p /var/www/html/.well-known/pki-validation/
vim /var/www/html/.well-known/pki-validation/whois.txt</pre>



<p>完成後確定從 email 給的連結可以看到剛剛的 whois.txt 檔案，即可與 TWCA 聯繫進行下一步。</p>



<h2 class="wp-block-heading para">安裝與設定 1.電子憑證 2.認證標章</h2>



<p>等待 TWCA 審核完成後收到一封 email 及一個壓縮檔，解壓縮後包含我們前面產生的檔案，共有以下</p>



<ol class="my-li bg-darkblue wp-block-list">
<li>server.key 伺服器金鑰</li>



<li>server.csr TWCA CSR 憑證申請檔</li>



<li>root.cer 根憑證</li>



<li>server.cer 伺服器憑證</li>



<li>uca.cer 中繼憑證</li>
</ol>



<p>這邊會用到的為 1, 4, 5 三個檔案，如果收到的檔案是 <code>uca_1.cer</code> 跟 <code>uca_2.cer</code>，可先透過 <code>cat uca_2.cer uca_1.cer &gt; uca.cer</code> 將檔案合併成一個。</p>



<p>以小蛙自己的環境 Apache2.4 為例，首先複製一份預設的檔案出來改</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/000-default-le-ssl.conf
vim /etc/apache2/sites-available/000-default-le-ssl.conf</pre>



<pre class="EnlighterJSRAW" data-enlighter-language="ini" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;IfModule mod_ssl.c>
&lt;VirtualHost *:443>
        ServerName 改成 TWCA 申請 SSL 的網址
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html/

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        Include /etc/letsencrypt/options-ssl-apache.conf  # 這個是因為小蛙有使用 letsencrypt
        SSLCertificateFile /etc/ssl/server.cer            # 加上這個
        SSLCertificateKeyFile /etc/ssl/server.key         # 加上這個
        SSLCertificateChainFile /etc/ssl/uca.cer          # 加上這個
&lt;/VirtualHost>
&lt;/IfModule></pre>



<p>儲存後啟用該站點，檢查沒問題後重起 apache 就完成囉！</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">a2ensite 000-default-le-ssl.conf
apache2ctl configtest
Syntax OK
service apache2 graceful</pre>



<p><strong>增加安全性系列：</strong></p>



<ul class="my-li bg-darkblue wp-block-list"><li><a href="https://noter.tw/10420/向-twca-申請-ssl-憑證-ubuntu-apache/" data-wpel-link="internal">向 TWCA 申請 SSL 憑證 (Ubuntu, Apache)</a></li><li><a href="https://noter.tw/34/ubuntu-16-04-%E5%8D%87%E7%B4%9A-phpmyadmin-%E4%B8%A6%E9%96%8B%E5%95%9F%E4%BA%8C%E9%9A%8E%E6%AE%B5%E9%A9%97%E8%AD%89-2fa/" data-wpel-link="internal">Ubuntu 16.04 升級 phpMyAdmin 並開啟二階段驗證( 2FA )</a></li><li><a href="https://noter.tw/255/ubuntu-16-04-安裝-fail2ban/" data-wpel-link="internal">Ubuntu 16.04 安裝 fail2ban</a></li></ul>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/10420/%e5%90%91-twca-%e7%94%b3%e8%ab%8b-ssl-%e6%86%91%e8%ad%89-ubuntu-apache/" data-wpel-link="internal">向 TWCA 申請 SSL 憑證 (Ubuntu, Apache)</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://noter.tw/10420/%e5%90%91-twca-%e7%94%b3%e8%ab%8b-ssl-%e6%86%91%e8%ad%89-ubuntu-apache/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Certbot error: ACMEv1 is deprecated and you can &#8230;</title>
		<link>https://noter.tw/9107/certbot-error-acmev1-is-deprecated/</link>
					<comments>https://noter.tw/9107/certbot-error-acmev1-is-deprecated/#respond</comments>
		
		<dc:creator><![CDATA[黃小蛙]]></dc:creator>
		<pubDate>Fri, 13 Aug 2021 04:30:00 +0000</pubDate>
				<category><![CDATA[Web Server]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[技術相關]]></category>
		<category><![CDATA[ACMEv1 is deprecated]]></category>
		<category><![CDATA[upgrad certbot]]></category>
		<category><![CDATA[apt-get install upgrade]]></category>
		<category><![CDATA[免費 ssl]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[https]]></category>
		<category><![CDATA[ssl]]></category>
		<category><![CDATA[certbot]]></category>
		<guid isPermaLink="false">https://noter.tw/?p=9107</guid>

					<description><![CDATA[<p>今天好友說有一個網站的 SSL 過期了，請小蛙幫忙看一下，下指令更新會出現 Certbot error: ACMEv1 is deprecated 使用免費的 SSL 就要承受每三個月過期一次的麻煩，&#46;&#46;&#46;</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/9107/certbot-error-acmev1-is-deprecated/" data-wpel-link="internal">Certbot error: ACMEv1 is deprecated and you can &#8230;</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>今天好友說有一個網站的 SSL 過期了，請小蛙幫忙看一下，下指令更新會出現 Certbot error: ACMEv1 is deprecated </p>



<span id="more-9107"></span>



<p>使用<a href="https://noter.tw/3695/ssl-for-free-%e5%85%8d%e8%b2%bb%e5%8f%88%e6%9c%89%e7%b6%a0%e8%89%b2%e9%8e%96%e9%a0%ad%e7%9a%84-ssl-certificates/" target="_blank" rel="noreferrer noopener" data-wpel-link="internal">免費的 SSL</a> 就要承受每三個月過期一次的麻煩，但是想想三個月過期一次就可以省一大筆錢，似乎又還蠻划算的～之前遇到很多種奇怪的狀況，這篇記錄一下第一次遇到這種 ACMEv1。</p>



<p>小蛙覺得奇怪，怎麼去年三月到現在已經正常運行那麼久了，卻在這時候突然失靈，輸入 certbot run 的指令後出現 ACMEv1 is deprecated and you can bla bla bla 通常附上的連結點過去都沒什麼結果，直接把相關問題丟 Google 比較實在。</p>



<p>經過一番查詢後才知道原來是 certbot 的版本更新了，原本使用的 ACMEv1 已經不能使用，好友網站是 Ubuntu 16.04 LTS，<a href="https://askubuntu.com/questions/44122/how-to-upgrade-a-single-package-using-apt-get" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right">更新<span class="wpel-icon wpel-image wpel-icon-6"></span></a>也很簡單</p>



<pre class="wp-block-preformatted withcode">apt-get install --only-upgrade certbot</pre>



<p>期間可能會連帶更新例如 python3 等相依的套件，等他跑完就完成了！</p>



<p><strong>網站架設系列文章：</strong></p>



<ul class="my-li bg-darkblue wp-block-list"><li><a href="https://noter.tw/10151/%e7%9b%a4%e9%bb%9e%e9%82%a3%e4%ba%9b%e6%9b%be%e7%b6%93%e9%99%aa%e4%bc%b4%e9%81%8e%e5%b0%8f%e8%9b%99%e7%9a%84-vps-%e8%99%9b%e6%93%ac%e4%b8%bb%e6%a9%9f/" data-wpel-link="internal">盤點那些曾經陪伴過小蛙的 VPS 虛擬主機</a></li><li><a href="https://noter.tw/176/%e5%a6%82%e4%bd%95%e6%8c%91%e9%81%b8-vps-%e6%9c%80%e5%88%92%e7%ae%97%e7%9a%84%e8%b2%b7%e6%b3%95/" data-wpel-link="internal">如何挑選 VPS + 最划算的買法</a></li><li><a href="https://noter.tw/406/%E6%89%8B%E6%8A%8A%E6%89%8B%E6%95%99%E4%BD%A0%E5%A6%82%E4%BD%95%E8%B3%BC%E8%B2%B7-vps/" data-wpel-link="internal">手把手教你如何購買 VPS</a></li><li><a href="https://noter.tw/4463/第一次買-kvm-虛擬主機/" data-wpel-link="internal">第一次買 KVM 虛擬主機</a></li><li><a href="https://noter.tw/4242/%e8%a1%80%e7%9a%84%e6%95%99%e8%a8%93-hiformance-%e8%b7%91%e8%b7%af%e4%ba%86/" data-wpel-link="internal">血的教訓 &#8211; HiFormance 跑路了 &#8230;</a></li><li><a href="https://noter.tw/196/%e7%82%ba%e8%87%aa%e5%b7%b1%e7%94%b3%e8%ab%8b%e4%b8%80%e5%80%8b%e5%9f%9f%e5%90%8d-hinet-%e7%82%ba%e4%be%8b/" data-wpel-link="internal">為自己申請一個域名 – HiNet 為例</a></li><li><a href="https://noter.tw/117/cloudflare-%E8%B6%85%E5%BC%B7%E5%A4%A7%E7%9A%84%E5%85%8D%E8%B2%BB-cdn/" data-wpel-link="internal">Cloudflare – 超強大的免費 CDN (?)</a></li><li><a href="https://noter.tw/195/%e4%bd%bf%e7%94%a8-cloudflare-%e4%bb%a3%e7%ae%a1%e4%bd%a0%e7%9a%84%e5%9f%9f%e5%90%8d/" data-wpel-link="internal">使用 Cloudflare 代管你的域名</a></li><li><a href="https://noter.tw/396/ubuntu-16-04-設定環境語言編碼，讓中文可以正常顯示/" data-wpel-link="internal">Ubuntu 16.04 設定環境語言編碼，讓中文可以正常顯示</a></li><li><a href="https://noter.tw/255/ubuntu-16-04-%e5%ae%89%e8%a3%9d-fail2ban/" data-wpel-link="internal">Ubuntu 16.04 安裝 fail2ban</a></li><li><a href="https://noter.tw/436/%E4%B8%80%E5%80%8B%E8%85%B3%E6%9C%AC%E6%AF%8F%E5%A4%A9%E8%87%AA%E5%8B%95%E5%82%99%E4%BB%BD/" data-wpel-link="internal">一個腳本每天自動備份</a></li><li><a href="https://noter.tw/32/linux-tar-%E5%AE%8C%E6%95%B4%E5%82%99%E4%BB%BD%E3%80%81%E5%A2%9E%E9%87%8F%E5%82%99%E4%BB%BD%E5%8F%8A%E5%B7%AE%E7%95%B0%E5%82%99%E4%BB%BD%E6%AF%94%E8%BC%83/" data-wpel-link="internal">Linux tar 完整備份、增量備份及差異備份比較</a></li><li><a href="https://noter.tw/3704/nginx-ssl-certificate-%E8%AE%93-http-%E8%AE%8A%E8%BA%AB%E6%88%90%E7%82%BA-https/" data-wpel-link="internal">nginx + SSL Certificate – 讓 http 變身成為 https</a></li><li><a href="https://noter.tw/3695/ssl-for-free-%E5%85%8D%E8%B2%BB%E5%8F%88%E6%9C%89%E7%B6%A0%E8%89%B2%E9%8E%96%E9%A0%AD%E7%9A%84-ssl-certificates/" data-wpel-link="internal">SSL For Free – 免費又有綠色鎖頭的 SSL Certificates</a></li><li><a href="https://noter.tw/8596/certbot-error/" data-wpel-link="internal">Certbot 申請 SSL certificate 錯誤問題</a></li><li><a href="https://noter.tw/9107/certbot-error-acmev1-is-deprecated/" data-wpel-link="internal">Certbot 錯誤：ACMEv1 is deprecated and you can …</a></li><li><a href="https://noter.tw/5967/ubuntu-18-04-%e5%ae%89%e8%a3%9d-awstats-%e4%be%86%e7%b5%b1%e8%a8%88%e7%b6%b2%e7%ab%99%e6%b5%81%e9%87%8f/" data-wpel-link="internal">Ubuntu 18.04 安裝 AWStats 來統計網站流量</a></li><li><a href="https://noter.tw/9287/pchome-%e8%b2%b7%e7%b6%b2%e5%9d%80%e7%ba%8c%e7%b4%84%e6%b5%81%e7%a8%8b/" data-wpel-link="internal">PCHome 買網址續約流程</a></li></ul>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/9107/certbot-error-acmev1-is-deprecated/" data-wpel-link="internal">Certbot error: ACMEv1 is deprecated and you can &#8230;</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://noter.tw/9107/certbot-error-acmev1-is-deprecated/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure 抗戰歷程</title>
		<link>https://noter.tw/8623/received-fatal-alert-handshake_failure/</link>
					<comments>https://noter.tw/8623/received-fatal-alert-handshake_failure/#comments</comments>
		
		<dc:creator><![CDATA[黃小蛙]]></dc:creator>
		<pubDate>Fri, 25 Jun 2021 08:54:43 +0000</pubDate>
				<category><![CDATA[程式開發]]></category>
		<category><![CDATA[一般程式]]></category>
		<category><![CDATA[java 1.8]]></category>
		<category><![CDATA[jre]]></category>
		<category><![CDATA[java ssl error]]></category>
		<category><![CDATA[https]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[javax.net.ssl.SSLHandshakeException]]></category>
		<category><![CDATA[Received fatal alert: handshake_failure]]></category>
		<category><![CDATA[handshake_failure]]></category>
		<category><![CDATA[java 1.7]]></category>
		<guid isPermaLink="false">https://noter.tw/?p=8623</guid>

					<description><![CDATA[<p>小蛙的工作常常要維護很多有年代的系統，這些系統有些已經找不到源頭或甚至沒有文件留下來了，前一段時間一直碰到抓 https 的時候噴錯的狀況，這篇把這段很痛苦的經歷記錄下來，希望能幫助遇到相同問題的朋友&#46;&#46;&#46;</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/8623/received-fatal-alert-handshake_failure/" data-wpel-link="internal">javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure 抗戰歷程</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>小蛙的工作常常要維護很多有年代的系統，這些系統有些已經找不到源頭或甚至沒有文件留下來了，前一段時間一直碰到抓 https 的時候噴錯的狀況，這篇把這段很痛苦的經歷記錄下來，希望能幫助遇到相同問題的朋友。</p>



<span id="more-8623"></span>



<p>早期很多網站都是 http 的，到現在各家大廠的推波助瀾下，你沒有 https 就被當作是不合群的、有危險的、跟不上潮流的網站(?!)，總之當有人上你的網站，但你的網站沒有 https 的時候，各大瀏覽器就會很不客氣的提示：您與這個網站的連線不安全，有些人看到這些提示怕都怕死了根本不敢連～</p>



<p>小蛙這次要處理的系統是早期抓網站圖片的工具，由於是早期開發的，當時幾乎都是 http 為主的網站，這支程式也完全沒有考慮 https 的問題 (當時合作的單位完全沒有 https)，這一兩年來這個問題慢慢顯露出來，有些要抓的網站也在我們自己單位，因此可以透過一些特殊的方法來處理，但是今天遇到 &#8230; 要抓外面單位的網站，這 &#8230; 折騰了小蛙一整天啊。</p>



<p class="pre left green">小蛙給一個最簡單卻也是最困難的建議：更新到 JRE 1.8</p>



<p>小蛙試了超多網路上找到的方法，如果你已經在網路上找很久了，那小蛙用的方法你一定都試過，應該也都還是失敗 &#8230; (跟小蛙一樣)，最後決定直接安裝 JRE 1.8。來看一下這討人厭的錯誤訊息</p>



<pre class="wp-block-preformatted withcode">Exception in thread "main" javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
     at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
     at sun.security.ssl.Alerts.getSSLException(Alerts.java:154)
     at sun.security.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1959)
     at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1077)
     at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1312)
     at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1339)
     at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1323)
     at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:563)
     at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
     at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:153)
     at TESTSSL.downloadRemoteImage(TESTSSL.java:37)
     at TESTSSL.downloadRemoteImage(TESTSSL.java:53)
     at TESTSSL.main(TESTSSL.java:74)</pre>



<p>直接看小蛙 Eclipse 的設定，Compiler 的地方使用 1.7 </p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img decoding="async" src="https://lh3.googleusercontent.com/pw/ACtC-3e9Jzy_2bG9HQE6aGNsNevI25pm7FJoS7MK_g-QL-g7O5Ho40-uzMk3igXTjhZYUpuQ9ja4_KPfJDxNq2Ei60AJbo6GWbhyk5GWis4JIZMNARbGNOWPta4CUK-uMW2VcqeDKyD1UdxsuyqdEUxCKI0Q8Q=w831-h788-no?authuser=2" alt="ACtC 3e9Jzy 2bG9HQE6aGNsNevI25pm7FJoS7MK g QL g7O5Ho40 uzMk3igXTjhZYUpuQ9ja4 KPfJDxNq2Ei60AJbo6GWbhyk5GWis4JIZMNARbGNOWPta4CUK uMW2VcqeDKyD1UdxsuyqdEUxCKI0Q8Q=w831 h788 no?authuser=2 javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure 抗戰歷程" title="javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure 抗戰歷程"></figure></div>



<p>Java Build Path 也是使用 jdk 1.7.0_45</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img decoding="async" src="https://lh3.googleusercontent.com/pw/ACtC-3f7rafyHQzMcgF3Od_mfpt9y8ZXQoDpnmU51K3zzzML-oZom0p3IkeC5ECLoWU2K2Ic6eiaECBVP6fpa9tjYLmGHAYXkWmkeorJi55ULGHsxLBafeg8IH3YRSZoxO6ncqvAmEyFi3upQFI_iKUEjC38OA=w831-h788-no?authuser=2" alt="ACtC 3f7rafyHQzMcgF3Od mfpt9y8ZXQoDpnmU51K3zzzML oZom0p3IkeC5ECLoWU2K2Ic6eiaECBVP6fpa9tjYLmGHAYXkWmkeorJi55ULGHsxLBafeg8IH3YRSZoxO6ncqvAmEyFi3upQFI iKUEjC38OA=w831 h788 no?authuser=2 javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure 抗戰歷程" title="javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure 抗戰歷程"></figure></div>



<p>Run Configurations 的 JRE 設定也是選擇 jdk 1.7.0_45</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AM-JKLWHU1lL8wQEAIaIRR3gi-P47_XCOsGwV72aWXOkHX_G4e3NOgFI5uFLVBgmOxyOgp4pV36EiE-ZckUO9-AQHbp9ghuyxXFyljn1jn_kFzFQHUTiGMwtWgifDVcWhbB2DzsfTSsAvNpXZv5vCwjusEZrGA=w693-h296-no?authuser=2" alt="AM JKLWHU1lL8wQEAIaIRR3gi P47 XCOsGwV72aWXOkHX G4e3NOgFI5uFLVBgmOxyOgp4pV36EiE ZckUO9 AQHbp9ghuyxXFyljn1jn kFzFQHUTiGMwtWgifDVcWhbB2DzsfTSsAvNpXZv5vCwjusEZrGA=w693 h296 no?authuser=2 javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure 抗戰歷程" title="javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure 抗戰歷程"></figure></div>



<p>執行下去就是這個錯誤 &#8230;</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img decoding="async" src="https://lh3.googleusercontent.com/pw/ACtC-3f9jG0XqkmNx4fEHhjEK90x9RWkI-C3TYAjN7SxSuC5BPHiIOODq3mSyGK5YMRRwZ6Txt3q9yNt0R75LCOpFalfA74bFUUKtHOQ0KBSJAQ8mBvdHHbvvN1uUBWgdjX12jEetzKb0TapfRn7TC0K39ZwDw=w1357-h400-no?authuser=2" alt="ACtC 3f9jG0XqkmNx4fEHhjEK90x9RWkI C3TYAjN7SxSuC5BPHiIOODq3mSyGK5YMRRwZ6Txt3q9yNt0R75LCOpFalfA74bFUUKtHOQ0KBSJAQ8mBvdHHbvvN1uUBWgdjX12jEetzKb0TapfRn7TC0K39ZwDw=w1357 h400 no?authuser=2 javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure 抗戰歷程" title="javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure 抗戰歷程"></figure></div>



<p>如果手動安裝了 JRE 8，然後把 Run Configurations 的 JRE 設定成 JRE 8</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img decoding="async" src="https://lh3.googleusercontent.com/pw/AM-JKLXwW-GbryLhs1UBdvpWDXYSb6Thx52bsxaVDbxndptJjpt_Vc2qrQ2zyx0ih1P6aSrZL2hNoUsH5P_ezZ7AAd5YR4x-yOITS2WcCkx-rT07BvWLix9BLbIOcs-v67eos6VLo3VsUxWOiwIlK3u6xkYi7Q=w686-h282-no?authuser=2" alt="AM JKLXwW GbryLhs1UBdvpWDXYSb6Thx52bsxaVDbxndptJjpt Vc2qrQ2zyx0ih1P6aSrZL2hNoUsH5P ezZ7AAd5YR4x yOITS2WcCkx rT07BvWLix9BLbIOcs v67eos6VLo3VsUxWOiwIlK3u6xkYi7Q=w686 h282 no?authuser=2 javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure 抗戰歷程" title="javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure 抗戰歷程"></figure></div>



<p>就打完收工了 &#8230; 真的是太敢動 (嗚嗚嗚)，原本小蛙一直想要在 1.7 的環境下想辦法處理，試了一大堆方法沒有一個可以動的，因為改來改去改到亂七八糟，就連把環境升上 1.8 也都還是不行 &#8230; 後來發現 Eclipse 執行的時候可以選擇運行環境，就決定專案的 Compiler 跟 Build Path 維持 1.7，Run Configurations 改成 JRE 1.8 &#8230; 不想繼續糾結下去 Orz &#8230; 但有一些 JSP 環境下沒辦法這樣處理的還是很頭大啊 >&lt;</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/8623/received-fatal-alert-handshake_failure/" data-wpel-link="internal">javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure 抗戰歷程</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://noter.tw/8623/received-fatal-alert-handshake_failure/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Certbot 申請 SSL certificate 錯誤問題</title>
		<link>https://noter.tw/8596/certbot-error/</link>
					<comments>https://noter.tw/8596/certbot-error/#respond</comments>
		
		<dc:creator><![CDATA[黃小蛙]]></dc:creator>
		<pubDate>Mon, 21 Jun 2021 15:36:28 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Web Server]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Invalid response from]]></category>
		<category><![CDATA[certificate]]></category>
		<category><![CDATA[.well-known]]></category>
		<category><![CDATA[ssl]]></category>
		<category><![CDATA[acme-challenge]]></category>
		<category><![CDATA[SSL For Free]]></category>
		<category><![CDATA[LetsEncrypt]]></category>
		<category><![CDATA[certbot]]></category>
		<category><![CDATA[certonly]]></category>
		<category><![CDATA[--dry-run]]></category>
		<category><![CDATA[The client lacks sufficient authorization]]></category>
		<category><![CDATA[Failed authorization procedure]]></category>
		<category><![CDATA[https]]></category>
		<category><![CDATA[--webroot]]></category>
		<guid isPermaLink="false">https://noter.tw/?p=8596</guid>

					<description><![CDATA[<p>今天幫好友處理 Certbot 的問題，這伺服器上已經申請過一個，這次要申請另一個域名，卻怎麼樣都會出現「The client lacks sufficient authorization」的錯誤，試&#46;&#46;&#46;</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/8596/certbot-error/" data-wpel-link="internal">Certbot 申請 SSL certificate 錯誤問題</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>今天幫好友處理 Certbot 的問題，這伺服器上已經申請過一個，這次要申請另一個域名，卻怎麼樣都會出現「The client lacks sufficient authorization」的錯誤，試了一些時間總算完成。</p>



<span id="more-8596"></span>



<p>Certbot 真的是個方便的東西，記得很久以前小蛙架部落格剛要轉 https 的時候，還要去 <a href="https://www.sslforfree.com/" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right">SSL for Free 網站<span class="wpel-icon wpel-image wpel-icon-6"></span></a>手動申請及安裝(可參考<a href="https://noter.tw/?s=ssl+for+free" target="_blank" rel="noreferrer noopener" data-wpel-link="internal">這邊</a>)，SSL for Free 的好處是申請 SSL 完全免費，但是有一個缺點是每三個月必須自己手動去更新(renew)，小蛙用了一段時間後發現，原來有 Certbot 這麼方便又好用的東西，之後有機會再來介紹這個，今天這篇只是要記錄使用 certbot 錯誤的解決方法。</p>



<p>是這樣的，在 Ubuntu 可以直接透過 certbot 申請 SSL 憑證，也包含了自動更新的功能，但是小蛙要申請一個新的網域的時候，卻發生了下列錯誤</p>



<pre class="wp-block-preformatted withcode">root@lc:/home/sysadm# certbot certonly --apache
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
Which names would you like to activate HTTPS for?
 
1: mydomain.com
 
Select the appropriate numbers separated by commas and/or spaces, or leave input blank to select all options shown (Enter 'c' to cancel): 1

Obtaining a new certificate
Performing the following challenges:
http-01 challenge for mydomain.com
Waiting for verification…
Cleaning up challenges
Failed authorization procedure. mydomain.com (http-01): urn:ietf:params:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://mydomain.com/.well-known/acme-challenge/xxxxxx [xxx.xxx.xxx.xxx]: "\n\n404 Not Found\n\n Not Found \n&lt;p"
 IMPORTANT NOTES:
 The following errors were reported by the server:
 Domain: mydomain.com
 Type:   unauthorized
 Detail: Invalid response from
 http://mydomain.com/.well-known/acme-challenge/xxxx
 [xxx.xxx.xxx.xxx]: "\n\n404 Not Found\n\n Not Found \n&lt;p"

To fix these errors, please make sure that your domain name was entered correctly and the DNS A/AAAA record(s) for that domain
contain(s) the right IP address.
Your account credentials have been saved in your Certbot configuration directory at /etc/letsencrypt. You should make a secure backup of this folder now. This configuration directory will also contain certificates and private keys obtained by Certbot so making regular backups of this folder is ideal. </pre>



<p>裡面看到幾個關鍵「Failed authorization procedure」、「unauthorized」、「Invalid response from」、「The client lacks sufficient authorization」</p>



<p>第一直覺是檔案連不到，但直接連 http://mydomain.com/.well-known/acme-challenge/xxxxxx 又沒有問題，看到朋友的主機有一堆奇怪的 site 設定檔，先清一清看看，嗯 ~ 好，沒有反應，錯誤還是存在。</p>



<p>一直發生上面的錯誤，不斷測試不斷重試，結果得到下面的錯誤 &#8230; (嗚嗚嗚)</p>



<pre class="wp-block-preformatted withcode">root@lc:/etc/apache2/sites-enabled# certbot --apache

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
Which names would you like to activate HTTPS for?
 
 1: mydomain.com
 
Select the appropriate numbers separated by commas and/or spaces, or leave input blank to select all options shown (Enter 'c' to cancel): 1

Obtaining a new certificate
An unexpected error occurred:
  There were too many requests of a given type :: Error creating new order :: too many failed authorizations recently: see https://letsencrypt.org/docs/rate-limits/
Please see the logfiles in /var/log/letsencrypt for more details.</pre>



<p>進去錯誤訊息給的<a href="https://letsencrypt.org/zh-tw/docs/rate-limits/" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right">連結<span class="wpel-icon wpel-image wpel-icon-6"></span></a>後，裡面有一段話寫著「我們還有<strong>網域驗證失敗</strong>限制，對於每個帳號每域名每小時 5 次的限制。在<a href="https://letsencrypt.org/zh-tw/docs/staging-environment/" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right">測試環境<span class="wpel-icon wpel-image wpel-icon-6"></span></a>中並沒有那麼嚴格的限制，因此你可以使用測試環境來針對連線問題除錯。」</p>



<p class="withcode">額外得知原來加了<code>--dry-run</code>就是測試環境，只會用來測試並不會真正儲存申請的憑證，而且限制比較沒那麼嚴格，如果是要測試為什麼申請失敗只要加上<code>--dry-run</code>，確定都沒有問題後才透過正式環境申請。小蛙這邊超過了每小時五次的限制，只能等到先用<code>--dry-run</code>來測試，等 unban 之後再到正式環境申請了。</p>



<p>經過重重困難後，決定一個參數一個參數試試看，於是試出了</p>



<pre class="wp-block-preformatted withcode">root@lc:/var/www/html# certbot certonly --webroot -w /var/www/html/ -d mydomain.com
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator webroot, Installer None
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for mydomain.com
Using the webroot path /var/www/html for all unmatched domains.
Waiting for verification…
Cleaning up challenges

IMPORTANT NOTES:
 Congratulations! Your certificate and chain have been saved at:
 /etc/letsencrypt/live/mydomain.com/fullchain.pem
 Your key file has been saved at:
 /etc/letsencrypt/live/mydomain.com/privkey.pem
 Your cert will expire on 2021-09-19. To obtain a new or tweaked
 version of this certificate in the future, simply run certbot
 again. To non-interactively renew <em>all</em> of your certificates, run
 "certbot renew"
 If you like Certbot, please consider supporting our work by:
 Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
 Donating to EFF: https://eff.org/donate-le </pre>



<p class="withcode">終於，加上了<code>--webroot -w /var/www/html/</code>之後就成功了 ~ 看起來可能是<code>.well-known/acme-challenge/xxxxxxx</code>的預設路徑不知道為什麼不在目前使用的目錄，導致驗證的時候會抓不到產生的驗證檔案而噴錯，加入該設定之後就完成了，這篇文章留給有需要的朋友 ~</p>



<p><strong>網站架設系列文章：</strong></p>



<ul class="my-li bg-darkblue wp-block-list"><li><a href="https://noter.tw/10151/%e7%9b%a4%e9%bb%9e%e9%82%a3%e4%ba%9b%e6%9b%be%e7%b6%93%e9%99%aa%e4%bc%b4%e9%81%8e%e5%b0%8f%e8%9b%99%e7%9a%84-vps-%e8%99%9b%e6%93%ac%e4%b8%bb%e6%a9%9f/" data-wpel-link="internal">盤點那些曾經陪伴過小蛙的 VPS 虛擬主機</a></li><li><a href="https://noter.tw/176/%e5%a6%82%e4%bd%95%e6%8c%91%e9%81%b8-vps-%e6%9c%80%e5%88%92%e7%ae%97%e7%9a%84%e8%b2%b7%e6%b3%95/" data-wpel-link="internal">如何挑選 VPS + 最划算的買法</a></li><li><a href="https://noter.tw/406/%E6%89%8B%E6%8A%8A%E6%89%8B%E6%95%99%E4%BD%A0%E5%A6%82%E4%BD%95%E8%B3%BC%E8%B2%B7-vps/" data-wpel-link="internal">手把手教你如何購買 VPS</a></li><li><a href="https://noter.tw/4463/第一次買-kvm-虛擬主機/" data-wpel-link="internal">第一次買 KVM 虛擬主機</a></li><li><a href="https://noter.tw/4242/%e8%a1%80%e7%9a%84%e6%95%99%e8%a8%93-hiformance-%e8%b7%91%e8%b7%af%e4%ba%86/" data-wpel-link="internal">血的教訓 &#8211; HiFormance 跑路了 &#8230;</a></li><li><a href="https://noter.tw/196/%e7%82%ba%e8%87%aa%e5%b7%b1%e7%94%b3%e8%ab%8b%e4%b8%80%e5%80%8b%e5%9f%9f%e5%90%8d-hinet-%e7%82%ba%e4%be%8b/" data-wpel-link="internal">為自己申請一個域名 – HiNet 為例</a></li><li><a href="https://noter.tw/117/cloudflare-%E8%B6%85%E5%BC%B7%E5%A4%A7%E7%9A%84%E5%85%8D%E8%B2%BB-cdn/" data-wpel-link="internal">Cloudflare – 超強大的免費 CDN (?)</a></li><li><a href="https://noter.tw/195/%e4%bd%bf%e7%94%a8-cloudflare-%e4%bb%a3%e7%ae%a1%e4%bd%a0%e7%9a%84%e5%9f%9f%e5%90%8d/" data-wpel-link="internal">使用 Cloudflare 代管你的域名</a></li><li><a href="https://noter.tw/396/ubuntu-16-04-設定環境語言編碼，讓中文可以正常顯示/" data-wpel-link="internal">Ubuntu 16.04 設定環境語言編碼，讓中文可以正常顯示</a></li><li><a href="https://noter.tw/255/ubuntu-16-04-%e5%ae%89%e8%a3%9d-fail2ban/" data-wpel-link="internal">Ubuntu 16.04 安裝 fail2ban</a></li><li><a href="https://noter.tw/436/%E4%B8%80%E5%80%8B%E8%85%B3%E6%9C%AC%E6%AF%8F%E5%A4%A9%E8%87%AA%E5%8B%95%E5%82%99%E4%BB%BD/" data-wpel-link="internal">一個腳本每天自動備份</a></li><li><a href="https://noter.tw/32/linux-tar-%E5%AE%8C%E6%95%B4%E5%82%99%E4%BB%BD%E3%80%81%E5%A2%9E%E9%87%8F%E5%82%99%E4%BB%BD%E5%8F%8A%E5%B7%AE%E7%95%B0%E5%82%99%E4%BB%BD%E6%AF%94%E8%BC%83/" data-wpel-link="internal">Linux tar 完整備份、增量備份及差異備份比較</a></li><li><a href="https://noter.tw/3704/nginx-ssl-certificate-%E8%AE%93-http-%E8%AE%8A%E8%BA%AB%E6%88%90%E7%82%BA-https/" data-wpel-link="internal">nginx + SSL Certificate – 讓 http 變身成為 https</a></li><li><a href="https://noter.tw/3695/ssl-for-free-%E5%85%8D%E8%B2%BB%E5%8F%88%E6%9C%89%E7%B6%A0%E8%89%B2%E9%8E%96%E9%A0%AD%E7%9A%84-ssl-certificates/" data-wpel-link="internal">SSL For Free – 免費又有綠色鎖頭的 SSL Certificates</a></li><li><a href="https://noter.tw/8596/certbot-error/" data-wpel-link="internal">Certbot 申請 SSL certificate 錯誤問題</a></li><li><a href="https://noter.tw/9107/certbot-error-acmev1-is-deprecated/" data-wpel-link="internal">Certbot 錯誤：ACMEv1 is deprecated and you can …</a></li><li><a href="https://noter.tw/5967/ubuntu-18-04-%e5%ae%89%e8%a3%9d-awstats-%e4%be%86%e7%b5%b1%e8%a8%88%e7%b6%b2%e7%ab%99%e6%b5%81%e9%87%8f/" data-wpel-link="internal">Ubuntu 18.04 安裝 AWStats 來統計網站流量</a></li><li><a href="https://noter.tw/9287/pchome-%e8%b2%b7%e7%b6%b2%e5%9d%80%e7%ba%8c%e7%b4%84%e6%b5%81%e7%a8%8b/" data-wpel-link="internal">PCHome 買網址續約流程</a></li></ul>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/8596/certbot-error/" data-wpel-link="internal">Certbot 申請 SSL certificate 錯誤問題</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://noter.tw/8596/certbot-error/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Ubuntu 16.04 curl: Server Certificate Verification Failed.</title>
		<link>https://noter.tw/281/ubuntu-16-04-curl-server-certificate-verification-failed/</link>
					<comments>https://noter.tw/281/ubuntu-16-04-curl-server-certificate-verification-failed/#respond</comments>
		
		<dc:creator><![CDATA[黃小蛙]]></dc:creator>
		<pubDate>Mon, 25 Jun 2018 05:28:16 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[https]]></category>
		<guid isPermaLink="false">https://noter.tw/?p=281</guid>

					<description><![CDATA[<p>今天看到有使用者留言說，我的股票精算師的指數不會更新了，小蛙檢查了一下，哇賽～從 5/16 開始就不會動了，立馬看看出了什麼問題。 一開始以為是之前搬伺服器的時候，Cloudflare 設定的問題，查&#46;&#46;&#46;</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/281/ubuntu-16-04-curl-server-certificate-verification-failed/" data-wpel-link="internal">Ubuntu 16.04 curl: Server Certificate Verification Failed.</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></description>
										<content:encoded><![CDATA[<p>今天看到有使用者留言說，我的股票精算師的指數不會更新了，小蛙檢查了一下，哇賽～從 5/16 開始就不會動了，立馬看看出了什麼問題。</p>
<p><span id="more-281"></span></p>
<p>一開始以為是之前搬伺服器的時候，Cloudflare 設定的問題，查了一段時間後發現連搜尋股票代號的功能都失效了，進資料庫看一下股票代號表，發現空白一片，此時大概知道問題出在哪裡。</p>
<p>把 crontab 裡更新股票代碼跟指數的 API 叫出來看一下發現「curl: server certificate verification failed.」這個錯誤，仔細看一下錯誤訊息裡面其實就有解決方法了，不過小蛙還是記錄一下備查。</p>
<p><img fetchpriority="high" decoding="async" class="aligncenter wp-image-4008" src="https://noter.tw/wp-content/uploads/2018/06/curlssl-1024x268.png" alt="curlssl Ubuntu 16.04 curl: Server Certificate Verification Failed." width="800" height="209" title="Ubuntu 16.04 curl: Server Certificate Verification Failed."></p>
<pre class="EnlighterJSRAW" data-enlighter-language="bash">curl: (60) server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
of Certificate Authority (CA) public keys (CA certs). If the default
bundle file isn't adequate, you can specify an alternate file
using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
the bundle, the certificate verification probably failed due to a
problem with the certificate (it might be expired, or the name might
not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
the -k (or --insecure) option.</pre>
<p>有看到亮點了嗎？原本是 curl https://wxxxxxxx 改成 curl -k https://wxxxxxx 就可以忽略掉這個問題，但是同時也要注意存取目的的安全性喔！</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/281/ubuntu-16-04-curl-server-certificate-verification-failed/" data-wpel-link="internal">Ubuntu 16.04 curl: Server Certificate Verification Failed.</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://noter.tw/281/ubuntu-16-04-curl-server-certificate-verification-failed/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>nginx + SSL Certificate &#8211; 讓 http 變身成為 https</title>
		<link>https://noter.tw/3704/nginx-ssl-certificate-%e8%ae%93-http-%e8%ae%8a%e8%ba%ab%e6%88%90%e7%82%ba-https/</link>
					<comments>https://noter.tw/3704/nginx-ssl-certificate-%e8%ae%93-http-%e8%ae%8a%e8%ba%ab%e6%88%90%e7%82%ba-https/#comments</comments>
		
		<dc:creator><![CDATA[黃小蛙]]></dc:creator>
		<pubDate>Fri, 08 Jul 2016 01:56:44 +0000</pubDate>
				<category><![CDATA[Web Server]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[ssl]]></category>
		<category><![CDATA[SSL For Free]]></category>
		<category><![CDATA[CA]]></category>
		<category><![CDATA[crt]]></category>
		<category><![CDATA[key]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[https]]></category>
		<guid isPermaLink="false">https://wazai.net/?p=3704</guid>

					<description><![CDATA[<p>接續&#160;SSL For Free – 免費又有綠色鎖頭的 SSL Certificates 申請好 SSL Certificate 之後，這篇記錄一下怎麼樣把 SSL Certificate &#46;&#46;&#46;</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/3704/nginx-ssl-certificate-%e8%ae%93-http-%e8%ae%8a%e8%ba%ab%e6%88%90%e7%82%ba-https/" data-wpel-link="internal">nginx + SSL Certificate &#8211; 讓 http 變身成為 https</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>接續&nbsp;<a rel="noreferrer noopener" aria-label=" (在新分頁中開啟)" href="https://noter.tw/3695/ssl-for-free-%e5%85%8d%e8%b2%bb%e5%8f%88%e6%9c%89%e7%b6%a0%e8%89%b2%e9%8e%96%e9%a0%ad%e7%9a%84-ssl-certificates/" target="_blank" data-wpel-link="internal">SSL For Free – 免費又有綠色鎖頭的 SSL Certificates</a> 申請好 SSL Certificate 之後，這篇記錄一下怎麼樣把 SSL Certificate 加入 nginx 中，讓 http 可以進化成 https。 </p>



<span id="more-3704"></span>



<div class="wp-block-image"><figure class="aligncenter"><a href="https://sshfs.crazyall.net/wazai/2016/07/computer-therms-2-1241965-640x480.jpg" target="_blank" rel="noopener nofollow external noreferrer" data-wpel-link="external"><img decoding="async" src="https://sshfs.crazyall.net/wazai/2016/07/computer-therms-2-1241965-640x480-500x375.jpg" alt="https" class="wp-image-3706" title="nginx + SSL Certificate - 讓 http 變身成為 https"></a><figcaption> 圖片來源：http://tw.freeimages.com/photo/computer-therms-2-1241965 </figcaption></figure></div>



<h2 class="para wp-block-heading">囉哩巴唆</h2>



<p>小蛙剛接觸 nginx 的時候，真是吃盡了苦頭，雖然說功能非常強大，但是有些功能 google 了好久才勉強達到，這裡提供的一些作法也許不是最好，小蛙相信有更優雅的作法，不過至少能達成小蛙的需求，正所謂能解決問題的就是好方法！先達到功能，之後看到更好的作法再慢慢修正。</p>



<h2 class="para wp-block-heading">準備所需的 crt 及 key</h2>



<p>把從&nbsp;<a rel="noreferrer noopener" aria-label=" (在新分頁中開啟)" href="https://noter.tw/3695/ssl-for-free-%e5%85%8d%e8%b2%bb%e5%8f%88%e6%9c%89%e7%b6%a0%e8%89%b2%e9%8e%96%e9%a0%ad%e7%9a%84-ssl-certificates/" target="_blank" data-wpel-link="internal">SSL For Free – 免費又有綠色鎖頭的 SSL Certificates</a>&nbsp;下載回來的 3 個檔案，分別是 ca_bundle.crt, certificate.crt, private.key，接下來我們要將 ca_bundle.crt 與 certificate.crt 合併，如果是用 windows 的話，用筆記本新增一個檔案叫做 bundle.crt，然後分別將 certificate.crt 跟 ca_bundle.crt 這兩個檔案的內容貼進 bundle.crt，要注意有沒有不小心複製到換行，或是空白字元，大概會變成下面這樣</p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code">-----BEGIN CERTIFICATE-----
...
certificate.crt 的內容
...
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
...
ca_bundle.crt 的內容
...
-----END CERTIFICATE-----</pre>



<p>如果像小蛙一樣使用 Linux 的話，可直接輸入</p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code">&gt;cat certificate.crt ca_bundle.crt &gt;&gt; bundle.crt
// 接著用編輯器把以下的魂結斷開
-----END CERTIFICATE----------BEGIN CERTIFICATE-----</pre>



<p>魂結沒有斷開的話，會得到這個錯誤 </p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code">[emerg] 20131#0: PEM_read_bio_X509_AUX("/etc/nginx/ssl/crazyall.net.crt") failed (SSL: error:0906D066:PEM routines:PEM_read_bio:bad end line)</pre>



<p>以小蛙的 nginx 為例，為了不要放檔案太亂，小蛙另外建了 ssl 資料夾，該目錄為 /etc/nginx/ssl/，並且將 bundle.crt 更名為 crazyall.net.crt，private.key 也更名為 crazyall.net.key，如此一來如果有多個網域搭配多個 SSL 會比較方便管理，完成後將 crazyall.net.crt 及 crazyall.net.key 複製到 /etc/nginx/ssl/ 資料夾中。</p>



<h2 class="para wp-block-heading">將 SSL 加入 nginx</h2>



<p>這裡記錄給自己看，預設的 nginx 檔案會包含一小段搭配載入 php5-fpm 的部份，例如：</p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code">location ~ \.php$ {
		fastcgi_split_path_info ^(.+\.php)(/.+)$;
		fastcgi_pass 127.0.0.1:9000;
		fastcgi_read_timeout 120;
		fastcgi_index index.php;
		include fastcgi_params;
}</pre>



<p>如果只有一個網域或一個站，直接這樣就好，但是像小蛙有 crazyall.net 以及 wazai.net 兩個，這一段就會重複，這時候可以把上面的內容獨立成 php.conf 並放在 /etc/nginx/ 資料夾下，接著從 /etc/nginx/sites-avaibale/wazai.net 設定檔中 include php.conf; 就可以了。</p>



<p>wazai.net 的設定部份如下 </p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code">server {
		listen 443 ssl default_server;	 	 
		listen [::]:443 ssl default_server;
		server_name wazai.net;
		ssl_certificate /etc/nginx/ssl/wazai.net.crt;	 	 
		ssl_certificate_key /etc/nginx/ssl/wazai.net.key;	 	 
		... 以下省略 ...	 	 
}</pre>



<p>這裡如果把 crazyall.net 使用一樣的設定就會得到下列錯誤</p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code">[emerg] 20005#0: a duplicate default server for 0.0.0.0:443 in /etc/nginx/sites-enabled/wazai.net:58</pre>



<p>因此如果同一台主機上有不只一個網域要使用 SSL，就要改成下面這樣，加了 default_server 就直接錯給你看</p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code">server {
		listen 443 ssl;
		server_name crazyall.net;
		ssl_certificate /etc/nginx/ssl/crazyall.net.crt;
		ssl_certificate_key /etc/nginx/ssl/crazyall.net.key;
		root /your_www_document;
		index index.php index.html index.htm;
		... 以下省略 ...
}</pre>



<p>經過這些修改 service nginx reload 就可以正常執行囉！試試看 https://your_domain/，如果是用 WordPress 架站的話，還會有很多很多很多問題需要克服，使用 Chrome 的 consloe 可以看到滿山滿谷的 </p>



<div class="wp-block-image"><figure class="aligncenter"><a href="https://sshfs.crazyall.net/wazai/2016/07/chrome_console_ng.png" target="_blank" rel="noopener nofollow external noreferrer" data-wpel-link="external"><img decoding="async" src="https://sshfs.crazyall.net/wazai/2016/07/chrome_console_ng-500x295.png" alt="滿山滿谷的 MixedContent" class="wp-image-3719" title="nginx + SSL Certificate - 讓 http 變身成為 https"></a><figcaption> 滿山滿谷的 MixedContent</figcaption></figure></div>



<p>而且網站打開來之後慘不忍睹， 這也是小蛙為什麼當初卻步的原因，下一篇根據 google 來的資料一一修正這些問題。</p>



<div class="wp-block-image"><figure class="aligncenter is-resized"><a href="https://sshfs.crazyall.net/wazai/2016/07/crazyall.png" target="_blank" rel="noopener nofollow external noreferrer" data-wpel-link="external"><img decoding="async" src="https://sshfs.crazyall.net/wazai/2016/07/crazyall.png" alt="http://crazyall.net" class="wp-image-3720" width="244" height="315" title="nginx + SSL Certificate - 讓 http 變身成為 https"></a><figcaption>正常的都瘋：http://crazyall.net</figcaption></figure></div>



<div class="wp-block-image"><figure class="aligncenter is-resized"><a href="https://sshfs.crazyall.net/wazai/2016/07/crazyallng.png" target="_blank" rel="noopener nofollow external noreferrer" data-wpel-link="external"><img decoding="async" src="https://sshfs.crazyall.net/wazai/2016/07/crazyallng.png" alt="慘不忍睹的都瘋：https://crazyall.net" class="wp-image-3721" width="244" height="314" title="nginx + SSL Certificate - 讓 http 變身成為 https"></a><figcaption>慘的都瘋：https://crazyall.net</figcaption></figure></div>



<h2 class="para wp-block-heading">參考資料</h2>



<ul class="my-li bg-darkblue wp-block-list"><li><a href="https://www.digicert.com/ssl-certificate-installation-nginx.htm" target="_blank" rel="noopener nofollow external noreferrer" data-wpel-link="external" class="wpel-icon-right">Nginx SSL Certificate Installation<span class="wpel-icon wpel-image wpel-icon-6"></span></a></li></ul>



<p><strong>網站架設系列文章：</strong></p>



<ul class="my-li bg-darkblue wp-block-list"><li><a href="https://noter.tw/10151/%e7%9b%a4%e9%bb%9e%e9%82%a3%e4%ba%9b%e6%9b%be%e7%b6%93%e9%99%aa%e4%bc%b4%e9%81%8e%e5%b0%8f%e8%9b%99%e7%9a%84-vps-%e8%99%9b%e6%93%ac%e4%b8%bb%e6%a9%9f/" data-wpel-link="internal">盤點那些曾經陪伴過小蛙的 VPS 虛擬主機</a></li><li><a href="https://noter.tw/176/%e5%a6%82%e4%bd%95%e6%8c%91%e9%81%b8-vps-%e6%9c%80%e5%88%92%e7%ae%97%e7%9a%84%e8%b2%b7%e6%b3%95/" data-wpel-link="internal">如何挑選 VPS + 最划算的買法</a></li><li><a href="https://noter.tw/406/%E6%89%8B%E6%8A%8A%E6%89%8B%E6%95%99%E4%BD%A0%E5%A6%82%E4%BD%95%E8%B3%BC%E8%B2%B7-vps/" data-wpel-link="internal">手把手教你如何購買 VPS</a></li><li><a href="https://noter.tw/4463/第一次買-kvm-虛擬主機/" data-wpel-link="internal">第一次買 KVM 虛擬主機</a></li><li><a href="https://noter.tw/4242/%e8%a1%80%e7%9a%84%e6%95%99%e8%a8%93-hiformance-%e8%b7%91%e8%b7%af%e4%ba%86/" data-wpel-link="internal">血的教訓 &#8211; HiFormance 跑路了 &#8230;</a></li><li><a href="https://noter.tw/196/%e7%82%ba%e8%87%aa%e5%b7%b1%e7%94%b3%e8%ab%8b%e4%b8%80%e5%80%8b%e5%9f%9f%e5%90%8d-hinet-%e7%82%ba%e4%be%8b/" data-wpel-link="internal">為自己申請一個域名 – HiNet 為例</a></li><li><a href="https://noter.tw/117/cloudflare-%E8%B6%85%E5%BC%B7%E5%A4%A7%E7%9A%84%E5%85%8D%E8%B2%BB-cdn/" data-wpel-link="internal">Cloudflare – 超強大的免費 CDN (?)</a></li><li><a href="https://noter.tw/195/%e4%bd%bf%e7%94%a8-cloudflare-%e4%bb%a3%e7%ae%a1%e4%bd%a0%e7%9a%84%e5%9f%9f%e5%90%8d/" data-wpel-link="internal">使用 Cloudflare 代管你的域名</a></li><li><a href="https://noter.tw/396/ubuntu-16-04-設定環境語言編碼，讓中文可以正常顯示/" data-wpel-link="internal">Ubuntu 16.04 設定環境語言編碼，讓中文可以正常顯示</a></li><li><a href="https://noter.tw/255/ubuntu-16-04-%e5%ae%89%e8%a3%9d-fail2ban/" data-wpel-link="internal">Ubuntu 16.04 安裝 fail2ban</a></li><li><a href="https://noter.tw/436/%E4%B8%80%E5%80%8B%E8%85%B3%E6%9C%AC%E6%AF%8F%E5%A4%A9%E8%87%AA%E5%8B%95%E5%82%99%E4%BB%BD/" data-wpel-link="internal">一個腳本每天自動備份</a></li><li><a href="https://noter.tw/32/linux-tar-%E5%AE%8C%E6%95%B4%E5%82%99%E4%BB%BD%E3%80%81%E5%A2%9E%E9%87%8F%E5%82%99%E4%BB%BD%E5%8F%8A%E5%B7%AE%E7%95%B0%E5%82%99%E4%BB%BD%E6%AF%94%E8%BC%83/" data-wpel-link="internal">Linux tar 完整備份、增量備份及差異備份比較</a></li><li><a href="https://noter.tw/3704/nginx-ssl-certificate-%E8%AE%93-http-%E8%AE%8A%E8%BA%AB%E6%88%90%E7%82%BA-https/" data-wpel-link="internal">nginx + SSL Certificate – 讓 http 變身成為 https</a></li><li><a href="https://noter.tw/3695/ssl-for-free-%E5%85%8D%E8%B2%BB%E5%8F%88%E6%9C%89%E7%B6%A0%E8%89%B2%E9%8E%96%E9%A0%AD%E7%9A%84-ssl-certificates/" data-wpel-link="internal">SSL For Free – 免費又有綠色鎖頭的 SSL Certificates</a></li><li><a href="https://noter.tw/8596/certbot-error/" data-wpel-link="internal">Certbot 申請 SSL certificate 錯誤問題</a></li><li><a href="https://noter.tw/9107/certbot-error-acmev1-is-deprecated/" data-wpel-link="internal">Certbot 錯誤：ACMEv1 is deprecated and you can …</a></li><li><a href="https://noter.tw/5967/ubuntu-18-04-%e5%ae%89%e8%a3%9d-awstats-%e4%be%86%e7%b5%b1%e8%a8%88%e7%b6%b2%e7%ab%99%e6%b5%81%e9%87%8f/" data-wpel-link="internal">Ubuntu 18.04 安裝 AWStats 來統計網站流量</a></li><li><a href="https://noter.tw/9287/pchome-%e8%b2%b7%e7%b6%b2%e5%9d%80%e7%ba%8c%e7%b4%84%e6%b5%81%e7%a8%8b/" data-wpel-link="internal">PCHome 買網址續約流程</a></li></ul>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/3704/nginx-ssl-certificate-%e8%ae%93-http-%e8%ae%8a%e8%ba%ab%e6%88%90%e7%82%ba-https/" data-wpel-link="internal">nginx + SSL Certificate &#8211; 讓 http 變身成為 https</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://noter.tw/3704/nginx-ssl-certificate-%e8%ae%93-http-%e8%ae%8a%e8%ba%ab%e6%88%90%e7%82%ba-https/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title>SSL For Free &#8211; 免費又有綠色鎖頭的 SSL Certificates</title>
		<link>https://noter.tw/3695/ssl-for-free-%e5%85%8d%e8%b2%bb%e5%8f%88%e6%9c%89%e7%b6%a0%e8%89%b2%e9%8e%96%e9%a0%ad%e7%9a%84-ssl-certificates/</link>
					<comments>https://noter.tw/3695/ssl-for-free-%e5%85%8d%e8%b2%bb%e5%8f%88%e6%9c%89%e7%b6%a0%e8%89%b2%e9%8e%96%e9%a0%ad%e7%9a%84-ssl-certificates/#respond</comments>
		
		<dc:creator><![CDATA[黃小蛙]]></dc:creator>
		<pubDate>Thu, 07 Jul 2016 15:00:54 +0000</pubDate>
				<category><![CDATA[Web Server]]></category>
		<category><![CDATA[免費資源]]></category>
		<category><![CDATA[軟體、工具]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[certificate]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[seo]]></category>
		<category><![CDATA[ssl]]></category>
		<category><![CDATA[SSL For Free]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[https]]></category>
		<guid isPermaLink="false">https://wazai.net/?p=3695</guid>

					<description><![CDATA[<p>之前聽說 Google 會優先搜尋有 https 的網頁 (參考：SEO優化：Google 調整SEO演算法，優先搜尋HTTPS網頁)，一直想把蛙齋也加入 SSL Certificate，一想到設定上&#46;&#46;&#46;</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/3695/ssl-for-free-%e5%85%8d%e8%b2%bb%e5%8f%88%e6%9c%89%e7%b6%a0%e8%89%b2%e9%8e%96%e9%a0%ad%e7%9a%84-ssl-certificates/" data-wpel-link="internal">SSL For Free &#8211; 免費又有綠色鎖頭的 SSL Certificates</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>之前聽說 Google 會優先搜尋有 https 的網頁 (參考：<a rel="noreferrer noopener nofollow external" href="http://seo.techroomage.com/2015/12/seo-optimization-google-change-seo-https.html" target="_blank" data-wpel-link="external" class="wpel-icon-right">SEO優化：Google 調整SEO演算法，優先搜尋HTTPS網頁<span class="wpel-icon wpel-image wpel-icon-6"></span></a>)，一直想把蛙齋也加入 SSL Certificate，一想到設定上的麻煩就卻步了，趁這次換 VPS 的時候，一次痛到底吧！印象中同事推薦過 <a rel="noreferrer noopener nofollow external" href="https://www.sslforfree.com/" target="_blank" data-wpel-link="external" class="wpel-icon-right">SSL For Free<span class="wpel-icon wpel-image wpel-icon-6"></span></a> 這個網站，而且可以有綠色鎖頭喔！於是抽空進行將網站加入 SSL 的工作！ </p>



<span id="more-3695"></span>



<div class="wp-block-image"><figure class="aligncenter"><a href="https://sshfs.crazyall.net/wazai/2016/07/sslforfree.png" target="_blank" rel="noopener nofollow external noreferrer" data-wpel-link="external"><img decoding="async" src="https://sshfs.crazyall.net/wazai/2016/07/sslforfree-500x311.png" alt="SSL For Free" class="wp-image-3697" title="SSL For Free - 免費又有綠色鎖頭的 SSL Certificates"></a><figcaption> 連結：https://www.sslforfree.com/ </figcaption></figure></div>



<h2 class="para wp-block-heading">囉哩巴唆</h2>



<p>Google 竟然把有 https 的網頁優先搜尋，看來加入 SSL 是勢在必行了，應該是因為跟 Google 自己後來想推的協定有關，不過看著 <a href="https://sofree.cc/" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right">香腸炒魷魚<span class="wpel-icon wpel-image wpel-icon-6"></span></a>、<a href="https://briian.com/" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right">重灌狂人<span class="wpel-icon wpel-image wpel-icon-6"></span></a> &#8230; 等一些知名網站也都已經是 https 開頭的了，這個趨勢只能跟風了！來個維基百科解釋一下這到底是什麼碗糕：</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>傳輸層安全協議（英語：Transport Layer Security，縮寫：TLS），及其前身安全通訊協定（Secure Sockets Layer，縮寫：SSL）是一種安全協定，目的是為網際網路通訊，提供安全及資料完整性保障。from&nbsp;<a href="https://zh.wikipedia.org/wiki/%E8%B6%85%E6%96%87%E6%9C%AC%E4%BC%A0%E8%BE%93%E5%AE%89%E5%85%A8%E5%8D%8F%E8%AE%AE" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right">傳輸層安全協議 &#8211; 維基百科<span class="wpel-icon wpel-image wpel-icon-6"></span></a><br>超文字傳輸安全協定（英語：Hypertext Transfer Protocol Secure，縮寫：HTTPS，也被稱為HTTP over TLS，HTTP over SSL或HTTP Secure）是一種網路安全傳輸協議。在計算機網路上，HTTPS經由超文字傳輸協定進行通訊，但利用SSL/TLS來對封包進行加密。HTTPS開發的主要目的，是提供對網路伺服器的身分認證，保護交換資料的隱私與完整性。 from&nbsp;<a href="https://zh.wikipedia.org/wiki/%E8%B6%85%E6%96%87%E6%9C%AC%E4%BC%A0%E8%BE%93%E5%AE%89%E5%85%A8%E5%8D%8F%E8%AE%AE" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right">超文字傳輸安全協定 &#8211; 維基百科<span class="wpel-icon wpel-image wpel-icon-6"></span></a></p></blockquote>



<p>好的，有看沒有懂或是覺得翻譯很奇怪，沒關係不重要，只要知道是對安全性有幫助的東西就好了！之前查了很多加入 SSL 的方法，以小蛙的智商實在是很難理解，也很佩服那些能做這些事情的人 &gt;&lt; 真正促使小蛙將蛙齋改成 https 是因為看到 SSL For Free 的使用方式真的很簡單，連小蛙這種系統白癡都可以順利完成，ㄟ &#8230; 好啦！在 nginx 設定上，還有一些觀念的理解上花了一些時間。</p>



<h2 class="para wp-block-heading">SSL For Free 申請</h2>



<p>主要有幾個步驟：(過程可參考：<a href="https://free.com.tw/ssl-for-free/" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right">SSL For Free 免費 SSL 憑證申請，使用 Let’s Encrypt 最簡單方法教學！<span class="wpel-icon wpel-image wpel-icon-6"></span></a>)</p>



<ul class="my-li bg-darkblue wp-block-list"><li>在 <a rel="noreferrer noopener nofollow external" href="https://www.sslforfree.com/" target="_blank" data-wpel-link="external" class="wpel-icon-right">SSL For Free<span class="wpel-icon wpel-image wpel-icon-6"></span></a> 上註冊一個帳號。</li><li>在首頁輸入要申請的網域名稱。像小蛙要申請 crazyall.net 這個網域，系統會自動產生 www.crazyall.net 跟 crazyall.net 這兩個網域。</li><li>選擇「Manually Verify Domain」進行手動認證網域。</li><li>下載網頁給的兩個檔案，把它們放在你的網域目錄 /.well-known/acme-challenge/ 資料夾下，放好之後點選下面的連結，看看是不是能夠讀取到這兩個檔案，確定可以讀取之後才點選「Download SSL Certificate」，不然如果驗證失敗，系統會產生另外的兩個檔案，然後要一直重複步驟 2 ~ 4。</li><li>點選「Download All SSL Certificate Files」下載所有檔案並保存好。</li></ul>



<p>到這邊就完成囉！nginx 設定部份請參考 <a href="https://noter.tw/3704/nginx-ssl-certificate-%e8%ae%93-http-%e8%ae%8a%e8%ba%ab%e6%88%90%e7%82%ba-https/" target="_blank" rel="noreferrer noopener" aria-label=" (在新分頁中開啟)" data-wpel-link="internal">nginx + SSL Certificate &#8211; 讓 http 變身成為 https</a>。</p>



<h2 class="para wp-block-heading">參考資料</h2>



<ul class="my-li bg-darkblue wp-block-list"><li><a href="https://www.sslforfree.com/" target="_blank" rel="noopener nofollow external noreferrer" data-wpel-link="external" class="wpel-icon-right">SSL For Free<span class="wpel-icon wpel-image wpel-icon-6"></span></a></li><li><a href="http://seo.techroomage.com/2015/12/seo-optimization-google-change-seo-https.html" target="_blank" rel="noopener nofollow external noreferrer" data-wpel-link="external" class="wpel-icon-right">SEO優化：Google 調整SEO演算法，優先搜尋HTTPS網頁<span class="wpel-icon wpel-image wpel-icon-6"></span></a></li><li><a href="https://noter.tw/3695/ssl-for-free-%e5%85%8d%e8%b2%bb%e5%8f%88%e6%9c%89%e7%b6%a0%e8%89%b2%e9%8e%96%e9%a0%ad%e7%9a%84-ssl-certificates/" data-wpel-link="internal">SSL For Free – 免費又有綠色鎖頭的 SSL Certificates</a></li></ul>



<p><strong>網站架設系列文章：</strong></p>



<ul class="my-li bg-darkblue wp-block-list"><li><a href="https://noter.tw/10151/%e7%9b%a4%e9%bb%9e%e9%82%a3%e4%ba%9b%e6%9b%be%e7%b6%93%e9%99%aa%e4%bc%b4%e9%81%8e%e5%b0%8f%e8%9b%99%e7%9a%84-vps-%e8%99%9b%e6%93%ac%e4%b8%bb%e6%a9%9f/" data-wpel-link="internal">盤點那些曾經陪伴過小蛙的 VPS 虛擬主機</a></li><li><a href="https://noter.tw/176/%e5%a6%82%e4%bd%95%e6%8c%91%e9%81%b8-vps-%e6%9c%80%e5%88%92%e7%ae%97%e7%9a%84%e8%b2%b7%e6%b3%95/" data-wpel-link="internal">如何挑選 VPS + 最划算的買法</a></li><li><a href="https://noter.tw/406/%E6%89%8B%E6%8A%8A%E6%89%8B%E6%95%99%E4%BD%A0%E5%A6%82%E4%BD%95%E8%B3%BC%E8%B2%B7-vps/" data-wpel-link="internal">手把手教你如何購買 VPS</a></li><li><a href="https://noter.tw/4463/第一次買-kvm-虛擬主機/" data-wpel-link="internal">第一次買 KVM 虛擬主機</a></li><li><a href="https://noter.tw/4242/%e8%a1%80%e7%9a%84%e6%95%99%e8%a8%93-hiformance-%e8%b7%91%e8%b7%af%e4%ba%86/" data-wpel-link="internal">血的教訓 &#8211; HiFormance 跑路了 &#8230;</a></li><li><a href="https://noter.tw/196/%e7%82%ba%e8%87%aa%e5%b7%b1%e7%94%b3%e8%ab%8b%e4%b8%80%e5%80%8b%e5%9f%9f%e5%90%8d-hinet-%e7%82%ba%e4%be%8b/" data-wpel-link="internal">為自己申請一個域名 – HiNet 為例</a></li><li><a href="https://noter.tw/117/cloudflare-%E8%B6%85%E5%BC%B7%E5%A4%A7%E7%9A%84%E5%85%8D%E8%B2%BB-cdn/" data-wpel-link="internal">Cloudflare – 超強大的免費 CDN (?)</a></li><li><a href="https://noter.tw/195/%e4%bd%bf%e7%94%a8-cloudflare-%e4%bb%a3%e7%ae%a1%e4%bd%a0%e7%9a%84%e5%9f%9f%e5%90%8d/" data-wpel-link="internal">使用 Cloudflare 代管你的域名</a></li><li><a href="https://noter.tw/396/ubuntu-16-04-設定環境語言編碼，讓中文可以正常顯示/" data-wpel-link="internal">Ubuntu 16.04 設定環境語言編碼，讓中文可以正常顯示</a></li><li><a href="https://noter.tw/255/ubuntu-16-04-%e5%ae%89%e8%a3%9d-fail2ban/" data-wpel-link="internal">Ubuntu 16.04 安裝 fail2ban</a></li><li><a href="https://noter.tw/436/%E4%B8%80%E5%80%8B%E8%85%B3%E6%9C%AC%E6%AF%8F%E5%A4%A9%E8%87%AA%E5%8B%95%E5%82%99%E4%BB%BD/" data-wpel-link="internal">一個腳本每天自動備份</a></li><li><a href="https://noter.tw/32/linux-tar-%E5%AE%8C%E6%95%B4%E5%82%99%E4%BB%BD%E3%80%81%E5%A2%9E%E9%87%8F%E5%82%99%E4%BB%BD%E5%8F%8A%E5%B7%AE%E7%95%B0%E5%82%99%E4%BB%BD%E6%AF%94%E8%BC%83/" data-wpel-link="internal">Linux tar 完整備份、增量備份及差異備份比較</a></li><li><a href="https://noter.tw/3704/nginx-ssl-certificate-%E8%AE%93-http-%E8%AE%8A%E8%BA%AB%E6%88%90%E7%82%BA-https/" data-wpel-link="internal">nginx + SSL Certificate – 讓 http 變身成為 https</a></li><li><a href="https://noter.tw/3695/ssl-for-free-%E5%85%8D%E8%B2%BB%E5%8F%88%E6%9C%89%E7%B6%A0%E8%89%B2%E9%8E%96%E9%A0%AD%E7%9A%84-ssl-certificates/" data-wpel-link="internal">SSL For Free – 免費又有綠色鎖頭的 SSL Certificates</a></li><li><a href="https://noter.tw/8596/certbot-error/" data-wpel-link="internal">Certbot 申請 SSL certificate 錯誤問題</a></li><li><a href="https://noter.tw/9107/certbot-error-acmev1-is-deprecated/" data-wpel-link="internal">Certbot 錯誤：ACMEv1 is deprecated and you can …</a></li><li><a href="https://noter.tw/5967/ubuntu-18-04-%e5%ae%89%e8%a3%9d-awstats-%e4%be%86%e7%b5%b1%e8%a8%88%e7%b6%b2%e7%ab%99%e6%b5%81%e9%87%8f/" data-wpel-link="internal">Ubuntu 18.04 安裝 AWStats 來統計網站流量</a></li><li><a href="https://noter.tw/9287/pchome-%e8%b2%b7%e7%b6%b2%e5%9d%80%e7%ba%8c%e7%b4%84%e6%b5%81%e7%a8%8b/" data-wpel-link="internal">PCHome 買網址續約流程</a></li></ul>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/3695/ssl-for-free-%e5%85%8d%e8%b2%bb%e5%8f%88%e6%9c%89%e7%b6%a0%e8%89%b2%e9%8e%96%e9%a0%ad%e7%9a%84-ssl-certificates/" data-wpel-link="internal">SSL For Free &#8211; 免費又有綠色鎖頭的 SSL Certificates</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://noter.tw/3695/ssl-for-free-%e5%85%8d%e8%b2%bb%e5%8f%88%e6%9c%89%e7%b6%a0%e8%89%b2%e9%8e%96%e9%a0%ad%e7%9a%84-ssl-certificates/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
