嵌入式就是這麼奇妙!nginx 在 x86 可以穩穩跑、在 ARM-based 的 linux 也能穩穩跑,但是在 LOA 上頭就是會收到 signal 7 訊號而掛掉!
最後則是想要編 debug 訊息來用,意外發現 -O0 時就一切正常了!
故,最佳化這種事,還是小心為妙。
2013年7月29日 星期一
Scripting Nginx with Lua (lua-nginx-module) 筆記 @ Linux
最近常用 nginx 開發服務,接著又碰碰 lua 的部分,十分彈性。接下來,移植到 ARM 裝置後,就開始進入 debug 模式 XD 需要追蹤一些 requests 的流向,又想到 lua 啦
nginx-test.conf
/tmp/nginx_lua.log:
Web:
如此一來,當 request 進來時,可以查看 /tmp/nginx_lua.log 看看到底走了幾個 requests,留意項目:
nginx-test.conf
location /lua {
default_type 'text/plain';
content_by_lua '
local currtime = ngx.localtime()
local file = io.open("/tmp/nginx_lua.log", "a");
file:write(currtime, "\\t", ngx.var.uri, "\\n");
file:write("\\t", ngx.var.args, "\\n");
file:close();
ngx.print(currtime, "\\n");
ngx.print(ngx.var.uri,"\\n");
ngx.print(ngx.var.args,"\\n");
--ngx.print(ngx.var.request_body, "\\n");
';
}
/tmp/nginx_lua.log:
2013-07-29 04:19:07 /lua
a=1&b=c&d
Web:
2013-07-29 04:19:07
/lua
a=1&b=c&d
如此一來,當 request 進來時,可以查看 /tmp/nginx_lua.log 看看到底走了幾個 requests,留意項目:
- 在 content_by_lua 中,要印出 newline 必須用 ngx.print( "\\n" ) ,但如果是在 access_by_lua_file 中,只需 ngx.print( "\n" ) 即可。
- 註解是用 "--" 而非用 "#" 或 "//" 開頭
2013年7月27日 星期六
使用微軟 Windows Live 管理中心免費郵件託管服務
想說前陣子買的 domain 該好好把玩一下,就想到 Mail server 服務啦。若曾架過站,應該不難體會維護一台機器、甚至一台 Mail server 是多重的任務了 XD 更別說中毒、被駭之後的處理流程等。所以,就先看看市面上有什麼好用的資源,除非不得已不然就不自己架站 :P
前陣子用過 Google Apps for Business 了,這次就改用微軟 Windows Live 管理中心吧!其實我沒特別討厭微軟,至從我用 MBP 被我操到常常出現多國語言的招呼聲或是瞬間登出等奇異現象後,我覺得微軟其實沒那麼糟 XDD
首先進入 https://domains.live.com 網頁後,點選"馬上開始":
輸入一些資料後,即可進入郵件託管設定頁面,首要之事就是(必須欄位)的設定,其實也真的只要設定這欄就好。
接著就是要去設定 DNS MX record 的部分,由於我是使用 Namecheap 服務,所以可以直接在 Namecheap 網站上設定完,十分便利(可參考 Namecheap - How can I set up MX records for my domain?):
如此一來,在切回 Windows Live 管理中心,點選"立刻更新"後,就會看到畫面更新為以下狀態,可以從 live.com 用自己的 email address 登入囉!
最後一提的,建立好的信箱可以用 POP3 協定收信囉:
POP3: pop3.live.com:995 (是否加密:Yes)
帳號:完整的 Email address (如:user@yourdomain.com)
2013年7月22日 星期一
[LOA] Linux on Android @ Android 4.x
圖片來源:Complete Linux Installer
最近把玩 Linux on Android (LOA),這的確是個還不錯的架構:
Complete Linux Installer - https://play.google.com/store/apps/details?id=com.zpwebsites.linuxonandroid簡單流程:
- Android 裝置要先 root 過
- 在 Android 裝置上跑 busybox 建制相關環境
- 採用 chroot 切換到 linux image 運行
更多細節:
# cat /data/data/com.zpwebsites.linuxonandroid/files/bootscript.sh其中運行最關鍵的是 busybox 這隻程式,安裝 Complete Linux Installer 有機會碰到 busybox 不能跑,需要自行把它編譯出來喔。看到 LOA 這等應用我才發現 busybox 還真的不是普通威啊! !
標籤:
實作筆記,
Android,
AndroidBoard
error: server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none while accessing https://code.google.com @ Ubuntu 12.04
最近在 Linux on Android 環境下,用 git 取東西時,發現了這個現象:
error: server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none while accessing https://code.google.com/p/xxxxx/info/refs解法:
$ export GIT_SSL_NO_VERIFY=1如此再接著用 git clone 或 git submodule update --init --recursive 就能搞定 :P (但處理的過程其實不好 XD 算閉眼不管這個問題)
訂閱:
文章 (Atom)