豆瓣似乎全面支持了HTTPS,這個真是可喜可賀!但是很多地方仍然存在漏網之魚,我記得豆瓣剛搞HTTPS的時候,主頁的廣告圖片不是走HTTPS的,於是小綠鎖上就顯示歎號,現在已經解決了。昨天想從豆瓣電臺下載一個蝦米已經不能播放的歌曲,意外發現只要打開網頁開發者工具主控臺(Console)就會把在聽的歌曲的mp3鏈接顯示出來,原因自然也是沒走HTTPS,於是順利拿到mp3文件。
一個兒童的共產主義夢想 - 周雲蓬
Which Side Are You On? - The Weavers
一個兒童的共產主義夢想-周雲蓬
大雨嘩嘩下喲 北京來電話
大雨嘩嘩下喲 北京來電話
去當兵 去當兵
他讓我去當兵
我還沒長大 我還沒長大
樓上和樓下 電燈和電話
樓上和樓下 電燈和電話
一拉燈 一拉燈
屋子裏亮通通
自來水擰一下
水流嘩啦啦
二零零零年 四個現代化
二零零零年 四個現代化
假話 空話 大話和廢話
不如去喝酒 喝醉了說胡話
不如去睡覺 睡著了說夢話
Which Side Are You On? - The Weavers
Which side are you on? (4)Come all of you good workers,
Good news to you I'll tell
Of how the good old union
Has come in here to dwell.
Which side are you on? (4)
My daddy was a miner
And I'm a miner's son,
And I'll stick with the union
'Til every battle's won.
Which side are you on? (4)
They say in Harlan County
There are no neutrals there;
You'll either be a union man,
Or a thug for J. H. Blair.
Which side are you on? (4)
Oh workers can you stand it?
Oh tell me how you can.
Will you be a lousy scab
Or will you be a man?
Which side are you on? (4)
Don't scab for the bosses,
Don't listen to their lies.
Us poor folks haven't got a chance
Unless we organize.
本文更新於 2018/11/08。
白露以後,太陽在七點前就會落山。下班路上經過公交站,每個等車的人的臉上都反著手機屏幕的光。他們在做什麼呢?看娛樂新聞,看政治軍事,看朋友圈,發微信。內心或喜或悲,並不溢於言表。不知道他們的精神世界是豐富還是匱乏。#Matrix#
但這仍是進步,人們可以在有限的情況下來選擇自己想要的信息,而不是完全被動的接收信息。這時最重要的問題是信息的獲取,信息的來源,信息的類型,信息的作用都值得稍微思考一下。否則即使是自己選的新聞娛樂,依舊和聽只有一個電台的收音機是一樣,除了做一下背景音消除一下尷尬,沒有任何意義。
吃飯工作睡覺XX,很重要,但肯定不是全部。
1609051753
天氣轉涼。
十一去台灣。
順利的話十二月去沖繩。
還要找學車的信息和學車,可是學了應該也不會經常開,會不會忘了呢。
深大在高爾夫球場養黑山羊挺好的。幾年前奄奄一息的大樹,在大樹營養快線的幫助下也起死回生了。
使用WordPress安卓客戶端,過了這麼多年,感覺還是不怎麼好用。
#代碼測試。
Monitorix安裝
Monitorix is a free, open source, lightweight system monitoring tool designed to monitor as many services and system resources as possible. 本文是在Centos上安裝Monitorix。
#先安裝依賴 yum install rrdtool rrdtool-perl perl-libwww-perl perl-MailTools perl-MIME-Lite perl-CGI perl-DBI perl-XML-Simple perl-Config-General perl-HTTP-Server-Simple perl-IO-Socket-SSL #3.8.1是20160810最新版 rpm -ivh http://www.monitorix.org/monitorix-3.8.1-1.noarch.rpm #添加到開機啟動 chkconfig --level 35 monitorix on #啟動Monitorix service monitorix start
這時,只要訪問在本地訪問http://localhost:8080/monitorix/Monitorix即可查看系統狀態了。
Monitorix配置
Centos中Monitorix的配置文件位於/etc/monitorix/monitorix.conf,下面的設置都是在這個文件中修改。
給Monitorix設置密碼很簡單,參考這裡http://www.monitorix.org/documentation.html#4。其中提到的用戶名密碼默認保存在/var/lib/monitorix/htpasswd裡面。關於密碼加密,我是用的這個https://github.com/mikaku/Monitorix/raw/master/docs/htpasswd.pl,下載後./htpasswd.pl執行,輸入密碼即可得到加密後的密碼,把加密後的密碼放到用戶名:後面即可。
關於Monitorix配置其實還有很多可以貼,等下次安裝的時候再詳細記錄下,普通看官方文檔就好。通常檢測網卡要設置一下,一般都不是eth0。
如果nginx的代理是https,那麼需要在配置文件httpd_builtin中添加https_url = y,這樣圖片才能也走https。
nginx代理配置
在nginx增加如下配置…… location /monitorix { # auth_basic "Restricted"; # auth_basic_user_file /etc/monitorix/monitorix-users; include proxy_params; proxy_pass http://127.0.0.1:8080/monitorix; allow 127.0.0.0/8; # since 3.5.0 version location ~ ^/monitorix/(.+\.png)$ { alias /var/lib/monitorix/www/$1; } } ……
其中的proxy_params,nginx似乎沒有自帶的文件,我参考了https://www.howtoforge.com/tutorial/how-to-install-nginx-as-reverse-proxy-for-apache-on-ubuntu-16-04/,其中這麼寫:
proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; client_max_body_size 100M; client_body_buffer_size 1m; proxy_intercept_errors on; proxy_buffering on; proxy_buffer_size 128k; proxy_buffers 256 16k; proxy_busy_buffers_size 256k; proxy_temp_file_write_size 256k; proxy_max_temp_file_size 0; proxy_read_timeout 300;
然後service nginx restart重啟nginx就可以了。
CentOS6.4安裝perl-HTTP-Server-Simple
CentOS6.4執行上面依賴包安裝後提示"No package perl-HTTP-Server-Simple available.",可參考perl-HTTP-Server-Simple-0.42-1.el6.noarch.rpm進行安裝。
本文更新於 2018/03/09。
獲取免費SSL證書
接上篇:CentOS6.6體驗_LNMP。下面將在nginx中配置Let's Encrypt頒發的免費SSL證書。安裝方式參考Certbot,文章寫的很清楚,這個方法我沒有試。
另一種安裝方式是Using Free SSL/TLS Certificates from Let’s Encrypt with NGINX,我用這個裝的,挺方便的。其中提到的文件/etc/letsencrypt/configs/my-domain.conf可以放在/etc/letsencrypt/my-domain.conf。這裡把證書生成後的nginx站點配置抄一下:
server { listen 443 ssl default_server; server_name my-domain; #ssl on;#有的網站配置中有寫這一句,但是這篇文章中並沒有,我也沒加,沒發現有什麼問題 ssl_certificate /etc/letsencrypt/live/my-domain/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/my-domain/privkey.pem; ... }
檢查nginx站點配置並重啟nginx
nginx -t && nginx -s reload
把http重定向到https
下面兩種方法據說第一種比第二種快,我也不知道為什麼,希望大神解答。
server { listen 80; server_name domain.com; return 301 https://$server_name$request_uri; } server { listen 443 ssl; server_name domain.com; ssl on; # other }
server { listen 80; server_name domain.com; rewrite ^(.*) https://$server_name$1 permanent; } server { listen 443 ssl; server_name domain.com; ssl on; # other }
自動更新Let's Encrypt的免費SSL證書(未完成)
按照參考鏈接Using Free SSL/TLS Certificates from Let’s Encrypt with NGINX設置好定時任務後發現renew‑letsencrypt.sh並沒有執行成功。因爲腳本中第一行需要選擇1還是2,自動運行時並沒有給出。所以我還是自己手動執行一下那個腳本,也不費事。
nginx配置HSTS
HTTP Strict Transport Security (通常简称为HSTS) 是一个安全功能,它告诉浏览器只能通过HTTPS访问当前资源, 禁止HTTP方式.
server { listen 443 ssl; add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; # This 'location' block inherits the STS header location / { root /usr/share/nginx/html; } # Because this 'location' block contains another 'add_header' directive, # we must redeclare the STS header location /servlet { add_header X-Served-By "My Servlet Handler"; add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; proxy_pass http://localhost:8080; } }
本文更新於 2016/10/28。