2016年1月7日 星期四

[資訊科學] nand2tetris

用十分鐘向nand2tetris學會設計處理器, 心動

http://www.nand2tetris.org/

[資訊安全] 申請憑證

話說 google 修改演算法, 將 HTTPS 的權重設定比較高, 怕網站沒人用, 就順手申請了憑證

第一次只有申請一年, 不太貴, 明年到期後再找 coupon 好了

從 godaddy 申請的憑證, 要搭配別地方 host 主機大概參考這幾篇文章就可以了

1.[筆記] SSL 憑證購買記
2. Godaddy SSL 購買與安裝
3. Ubuntu Server with Apache2 SSL Certificate Installation

我的設定是在 /etc/apache2/sites-available/000-default.conf 下, 內容和 *.80 相同
<virtualhost>
...
        SSLEngine on
        SSLCertificateFile /path/to/crt
        SSLCertificateKeyFile /path/to/key
        SSLCertificateChainFile /path/to/gd_bundle.crt
...
</virtualhost>
問題就是 /path/to/key 我用到原本 request 的檔案, 所以就錯誤啦 要注意第一行要這樣開頭的才行
-----BEGIN CERTIFICATE REQUEST-----
這樣就不對啦
-----BEGIN CERTIFICATE-----

這問題是參考 Installing SSL certificate causes the server to fail when restarting

同場加映如何強制 HTTP 導到 HTTPS?
NameVirtualHost *:80
<VirtualHost *:80>
   ServerName my.example.com
   DocumentRoot /path/to/doc
   Redirect permanent / https://my.example.com/
</VirtualHost>

<VirtualHost _default_:443>
   ServerName my.example.com
   DocumentRoot /path/to/doc
   SSLEngine On
   ...
</VirtualHost>
參考:http to https apache redirection