email 的傳遞有點像現實生活種的郵差先生在寄信
分為信封寄件者和信紙寄件者
envelope-from 顧名思義,就是寫在信封或是包裹上面的寄件者
所以是給郵差和MTA 看的
信紙寄件者,通常就是我們常看到信件的最下面寫著 XXX 敬上 .. 之類的稱呼
是給收件者看的,通常outlook 及其他MUA顯示的是這個欄位
php mail()
bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )
通常我們都會把From: 寫在第四個變數
但是這只是修改信紙寄件者
郵差先生看到的寄件者還是系統自動幫你帶的,不一定會跟From 會一樣
往往這樣可能會造成一些退信的狀況
建議From: 和 envelope from 都可以改成一致
避免不必要的困擾
example:
<?php
mail('ethan@a.com','Hello World!','Good morning!','From: service@b.com','-f service@b.com');
?>
PHP、MySQL與JavaScript學習手冊(第五版)
Learning PHP, MySQL & JavaScript, 5th Edition
作者: Robin Nixon
譯者: 賴屹民
出版社:歐萊禮
helloworld
- Sep 15 Fri 2017 14:49
使用php mail() 寄信並指定 envelope-from
- Sep 14 Thu 2017 15:35
使用Rufus 製作FreeBSD開機usb 隨身碟
下載 Rufus
https://rufus.akeo.ie/?locale=zh_TW
因為 Rufus 不支援 FreeBSD iso檔
所以我們選img檔案
以FreeBSD 11.1 為例
檔名為 FreeBSD-11.1-RELEASE-amd64-memstick.img
選擇剛剛下載的img檔,並下拉選擇DD映像
最後執行即可
【Ainmax】64GB 高速隨身碟(USB3.0)
- Sep 13 Wed 2017 16:40
移除比小強還強的 EFI 系統磁碟分割區
如果拿到一顆硬碟開心的要把它重新分割
但是始終保留一個 EFI 系統磁碟分割區 怎麼砍也砍不掉
這時候可以
用系統管理員身分執行cmd
輸入diskpart
C:\Windows\system32>diskpart Microsoft DiskPart 版本 6.1.7601 |
列出接在電腦的硬碟
DISKPART> list disk 磁碟 ### 狀態 大小 可用 Dyn Gpt |
選擇要清理的硬碟
DISKPART> select disk 1 磁碟 1 是所選擇的磁碟。 DISKPART> list disk 磁碟 ### 狀態 大小 可用 Dyn Gpt |
確定真的不留戀的話,輸入clean
DISKPART> clean DiskPart 成功地清理了磁碟。 DISKPART> |
回頭看windows 的磁碟管理,可以看到磁碟機已經乾乾淨淨啦
【WD】100EFAX 紅標 10TB 3.5吋NAS硬碟(NASware3.0)
http://www.momoshop.com.tw/goods/GoodsDetail.jsp?osm=league&i_code=4827757&cid=apuad&oid=1&memid=6000013660
- Aug 11 Fri 2017 10:16
啟用 drupal 8 clean URLs
安裝完drupal 8 之後,系統會需要你做一些簡單的設定
如果在需求檢查步驟出現以下的警告訊息
Your server is capable of using clean URLs, but it is not enabled. Using clean URLs gives an improved user experience and is recommended
表示你的 drupal 目錄無法使用rewrite 功能
如果是apache請確認以下設定
LoadModule rewrite_module libexec/apache24/mod_rewrite.so
Alias /drupal "/usr/local/www/drupal8"
<Directory "/usr/local/www/drupal8">
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
修改完後重新啟動apache
apachectl reload
Drupal的使用 中文版 第二版
作者: (美)拜倫
出版社:中國電力出版社
出版日期:2014/03/01
- Jul 27 Thu 2017 09:50
網路電影:《私室》The Bar
《私室》(英文:The Bar),2017年台灣原創網路劇,由網路劇《Mr.Bartender》導演徐嘉凱及其製作團隊SELFPICK獨立製作發行[1]。由謝祖武、黃尚禾、鄭人碩、蘇育惟、許乃涵、曾紫庭等人主演,溫昇豪、黃仲崑特別演出。該戲於2017年1月4日開拍,5月10日首播。他們的拍攝地點SELF私室酒吧也成立開張,一間專門負責調酒及傾聽客人的故事的酒吧。
- Jul 21 Fri 2017 16:27
Varnish 下的 backend 取得實際的client ip
預設的狀況下,varnish 下面的backend , 諸如 apache 或是 nginx ... 等
接到 http 的 請求時,client ip 都是varnish 的ip
如此一下,程式無法針對來源做出判斷,geoip 也無法知道來源是屬於哪個國家
解決這個問題步驟如下
編輯 varnish/default.vcl
sub vcl_recv {
###
if (req.restarts == 0) {
if (req.http.x-forwarded-for) {
set req.http.X-Forwarded-For = req.http.X-Forwarded-For + ", " + client.ip;
} else {
set req.http.X-Forwarded-For = client.ip;
}
}
###
}
修改backend log format 設定,以apache為例
#LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
即可在access_log 中看到實際使用者來源ip
- Jul 13 Thu 2017 09:56
CentOS 安裝 nslookup
nslookup這個指令對於網路除錯來說,應該是很多人都很習慣的工具
如果發現安裝好的Linux系統少了這個指令
[root@example ~]# nslookup myip.pass.tw
-bash: nslookup: command not found
[root@example ~]# which nslookup
/usr/bin/which: no nslookup in (/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
直接安裝看看咧? 找不到這個套件名稱
[root@example ~]# yum -y install nslookup
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirrors.linode.com
* epel: mirror.sfo12.us.leaseweb.net
* extras: mirrors.linode.com
* updates: mirrors.linode.com
No package nslookup available.
Error: Nothing to do
試試 yum provides 看看nslookup 是包含在哪個套件中
[root@example ~]# yum provides nslookup
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.linode.com
* epel: mirror.sfo12.us.leaseweb.net
* extras: mirrors.linode.com
* updates: mirrors.linode.com
Warning: 3.0.x versions of yum would erroneously match against filenames.
You can use "*/nslookup" and/or "*bin/nslookup" to get that behaviour
No Matches found
依提示再搜尋一下,可以發現包含在bind-utils 套件中
[root@example ~]# yum provides */nslookup
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.linode.com
* epel: mirror.sfo12.us.leaseweb.net
* extras: mirrors.linode.com
* updates: mirrors.linode.com
base/filelists_db | 6.4 MB 00:00
epel/filelists_db | 7.7 MB 00:01
extras/filelists_db | 25 kB 00:00
updates/filelists_db | 1.5 MB 00:00
zsh-4.3.11-4.el6.centos.2.x86_64 : A powerful interactive shell
Repo : base
Matched from:
Filename : /usr/share/zsh/4.3.11/functions/nslookup
32:bind-utils-9.8.2-0.62.rc1.el6.x86_64 : Utilities for querying DNS name servers
Repo : base
Matched from:
Filename : /usr/bin/nslookup
32:bind-utils-9.8.2-0.62.rc1.el6_9.2.x86_64 : Utilities for querying DNS name servers
Repo : updates
Matched from:
Filename : /usr/bin/nslookup
32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64 : Utilities for querying DNS name servers
Repo : updates
Matched from:
Filename : /usr/bin/nslookup
32:bind-utils-9.8.2-0.62.rc1.el6_9.1.x86_64 : Utilities for querying DNS name servers
Repo : updates
Matched from:
Filename : /usr/bin/nslookup
[root@example ~]# yum provides *bin/nslookup
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.linode.com
* epel: mirrors.kernel.org
* extras: mirrors.linode.com
* updates: mirrors.linode.com
32:bind-utils-9.8.2-0.62.rc1.el6.x86_64 : Utilities for querying DNS name servers
Repo : base
Matched from:
Filename : /usr/bin/nslookup
32:bind-utils-9.8.2-0.62.rc1.el6_9.2.x86_64 : Utilities for querying DNS name servers
Repo : updates
Matched from:
Filename : /usr/bin/nslookup
32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64 : Utilities for querying DNS name servers
Repo : updates
Matched from:
Filename : /usr/bin/nslookup
32:bind-utils-9.8.2-0.62.rc1.el6_9.1.x86_64 : Utilities for querying DNS name servers
Repo : updates
Matched from:
Filename : /usr/bin/nslookup
安裝 bind-utils
[root@example ~]# yum -y install bind-utils
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirrors.linode.com
* epel: mirrors.kernel.org
* extras: mirrors.linode.com
* updates: mirrors.linode.com
Resolving Dependencies
--> Running transaction check
---> Package bind-utils.x86_64 32:9.8.2-0.62.rc1.el6_9.4 will be installed
--> Processing Dependency: bind-libs = 32:9.8.2-0.62.rc1.el6_9.4 for package: 32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64
--> Processing Dependency: liblwres.so.80()(64bit) for package: 32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64
--> Processing Dependency: libisccfg.so.82()(64bit) for package: 32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64
--> Processing Dependency: libisccc.so.80()(64bit) for package: 32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64
--> Processing Dependency: libisc.so.83()(64bit) for package: 32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64
--> Processing Dependency: libdns.so.81()(64bit) for package: 32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64
--> Processing Dependency: libbind9.so.80()(64bit) for package: 32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64
--> Running transaction check
---> Package bind-libs.x86_64 32:9.8.2-0.62.rc1.el6_9.4 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================================================================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================================================================================================================
Installing:
bind-utils x86_64 32:9.8.2-0.62.rc1.el6_9.4 updates 189 k
Installing for dependencies:
bind-libs x86_64 32:9.8.2-0.62.rc1.el6_9.4 updates 892 k
Transaction Summary
=============================================================================================================================================================================================================================================
Install 2 Package(s)
Total download size: 1.1 M
Installed size: 2.7 M
Downloading Packages:
(1/2): bind-libs-9.8.2-0.62.rc1.el6_9.4.x86_64.rpm | 892 kB 00:00
(2/2): bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64.rpm | 189 kB 00:00
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 44 MB/s | 1.1 MB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : 32:bind-libs-9.8.2-0.62.rc1.el6_9.4.x86_64 1/2
Installing : 32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64 2/2
Verifying : 32:bind-libs-9.8.2-0.62.rc1.el6_9.4.x86_64 1/2
Verifying : 32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64 2/2
Installed:
bind-utils.x86_64 32:9.8.2-0.62.rc1.el6_9.4
Dependency Installed:
bind-libs.x86_64 32:9.8.2-0.62.rc1.el6_9.4
Complete!
DNS and BIND管理,第五版
作者: 蔣大偉
出版社:歐萊禮
- Jul 11 Tue 2017 11:55
[工商服務] 博客來曾拌麵特價
【過海製麵所】曾拌麵限量優惠組(香蔥椒麻*2袋+胡麻醬*1袋) (1袋4包入)
定價:675元
優惠價:465元
優惠期限:2017年07月11日止
- Jul 11 Tue 2017 09:18
CentOS / RedHat 安裝 varnish 4
Varnish cache,或稱Varnish,是一套高效能的反向網站快取伺服器(reverse proxy server)。
其他的類似產品還有Nginx 或是 Squid 可供選擇
官方網站
https://www.varnish-cache.org/
安裝步驟
# vi /etc/yum.repos.d/varnish.repo
[varnish]
name=Varnish for Enterprise Linux 6
baseurl=https://repo.varnish-cache.org/redhat/varnish-4.0/el6/
enabled=1
gpgkey=https://repo.varnish-cache.org/GPG-key.txt
gpgcheck=1
存檔離開
# yum -y install varnish
Loaded plugins: fastestmirror, security
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: centos.cs.nctu.edu.tw
* epel: mirror01.idc.hinet.net
* extras: centos.cs.nctu.edu.tw
* updates: centos.cs.nctu.edu.tw
Resolving Dependencies
--> Running transaction check
---> Package varnish.x86_64 0:4.0.4-1.el6 will be installed
--> Processing Dependency: jemalloc for package: varnish-4.0.4-1.el6.x86_64
--> Processing Dependency: gcc for package: varnish-4.0.4-1.el6.x86_64
--> Processing Dependency: libjemalloc.so.1()(64bit) for package: varnish-4.0.4-1.el6.x86_64
--> Running transaction check
---> Package gcc.x86_64 0:4.4.7-18.el6 will be installed
--> Processing Dependency: cpp = 4.4.7-18.el6 for package: gcc-4.4.7-18.el6.x86_64
--> Processing Dependency: cloog-ppl >= 0.15 for package: gcc-4.4.7-18.el6.x86_64
---> Package jemalloc.x86_64 0:3.6.0-1.el6 will be installed
--> Running transaction check
---> Package cloog-ppl.x86_64 0:0.15.7-1.2.el6 will be installed
--> Processing Dependency: libppl_c.so.2()(64bit) for package: cloog-ppl-0.15.7-1.2.el6.x86_64
--> Processing Dependency: libppl.so.7()(64bit) for package: cloog-ppl-0.15.7-1.2.el6.x86_64
---> Package cpp.x86_64 0:4.4.7-18.el6 will be installed
--> Processing Dependency: libmpfr.so.1()(64bit) for package: cpp-4.4.7-18.el6.x86_64
--> Running transaction check
---> Package mpfr.x86_64 0:2.4.1-6.el6 will be installed
---> Package ppl.x86_64 0:0.10.2-11.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
varnish x86_64 4.0.4-1.el6 varnish 1.5 M
Installing for dependencies:
cloog-ppl x86_64 0.15.7-1.2.el6 base 93 k
cpp x86_64 4.4.7-18.el6 base 3.7 M
gcc x86_64 4.4.7-18.el6 base 10 M
jemalloc x86_64 3.6.0-1.el6 epel 100 k
mpfr x86_64 2.4.1-6.el6 base 157 k
ppl x86_64 0.10.2-11.el6 base 1.3 M
Transaction Summary
================================================================================
Install 7 Package(s)
Total download size: 17 M
Installed size: 39 M
Downloading Packages:
(1/7): cloog-ppl-0.15.7-1.2.el6.x86_64.rpm | 93 kB 00:00
(2/7): cpp-4.4.7-18.el6.x86_64.rpm | 3.7 MB 00:00
(3/7): gcc-4.4.7-18.el6.x86_64.rpm | 10 MB 00:00
(4/7): jemalloc-3.6.0-1.el6.x86_64.rpm | 100 kB 00:00
(5/7): mpfr-2.4.1-6.el6.x86_64.rpm | 157 kB 00:00
(6/7): ppl-0.10.2-11.el6.x86_64.rpm | 1.3 MB 00:00
(7/7): varnish-4.0.4-1.el6.x86_64.rpm | 1.5 MB 00:04
--------------------------------------------------------------------------------
Total 2.1 MB/s | 17 MB 00:08
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : ppl-0.10.2-11.el6.x86_64 1/7
Installing : cloog-ppl-0.15.7-1.2.el6.x86_64 2/7
Installing : mpfr-2.4.1-6.el6.x86_64 3/7
Installing : cpp-4.4.7-18.el6.x86_64 4/7
Installing : gcc-4.4.7-18.el6.x86_64 5/7
Installing : jemalloc-3.6.0-1.el6.x86_64 6/7
Installing : varnish-4.0.4-1.el6.x86_64 7/7
Verifying : cpp-4.4.7-18.el6.x86_64 1/7
Verifying : varnish-4.0.4-1.el6.x86_64 2/7
Verifying : jemalloc-3.6.0-1.el6.x86_64 3/7
Verifying : mpfr-2.4.1-6.el6.x86_64 4/7
Verifying : gcc-4.4.7-18.el6.x86_64 5/7
Verifying : ppl-0.10.2-11.el6.x86_64 6/7
Verifying : cloog-ppl-0.15.7-1.2.el6.x86_64 7/7
Installed:
varnish.x86_64 0:4.0.4-1.el6
Dependency Installed:
cloog-ppl.x86_64 0:0.15.7-1.2.el6 cpp.x86_64 0:4.4.7-18.el6
gcc.x86_64 0:4.4.7-18.el6 jemalloc.x86_64 0:3.6.0-1.el6
mpfr.x86_64 0:2.4.1-6.el6 ppl.x86_64 0:0.10.2-11.el6
Complete!
安裝好的varnish 預設路徑
/etc/varnish/default.vcl
關鍵技術:CDN內容傳遞網路
Content Delivery Network
作者: 梁潔, 陳戈, 莊一嶸
出版社:佳魁資訊
出版日期:2017/03/28
語言:繁體中文
定價:480元
- Jul 05 Wed 2017 15:24
FreeBSD 10.x 安裝 Mongodb 3.4
更新ports tree
# portsnap fetch extract update
安裝 mongodb
# cd /usr/ports/databases/mongodb34
勾選相依套件選項
# make config-recursive
開始漫長的編譯,可以去泡個茶先
# make install clean
預設設定檔路徑
/usr/local/etc/mongodb.conf
設定開機自動執行
# vi /etc/rc.conf
mongod_enable="YES"
重開機或手動啟動mongodb
/usr/local/etc/rc.d/mongod start
OR
service mongod start
查看服務狀況,預設監聽 tcp 27017 port , 僅綁定 127.0.0.1 本機可以連線
可依需求修改設定檔
# netstat -na
Active Internet connections (including servers)
Proto Recv-Q Send-Q Local Address Foreign Address (state)
tcp4 0 0 127.0.0.1.27017 *.* LISTEN
執行程序
# ps uax | grep mongo
mongodb 3431 0.1 1.7 292860 69860 - S 3:17PM 0:02.20 /usr/local/bin/mongod --logpath /var/db/mongodb/mongod.log --logappend --config /usr/local/etc/mongodb.conf --dbpath /var/db/mongodb --fork
MongoDB 大數據管理系統實戰指南
作者: 郭遠威
出版社:上奇資訊
出版日期:2016/09/29
語言:繁體中文
定價:350元
- Jul 03 Mon 2017 15:34
freebsd透過ports安裝套件前,一次設定相依套件
假設如果要在freebsd透過ports 安裝apache24
除了是漫長的compile 過程外
再來就是不時會被其他相依套件中斷,提醒你要勾選相依套件的選項
想要好好去廁所大個便都不行
如果要解決這個問題,好好的去蹲廁所
可以參考以下步驟
# cd /usr/ports/www/apache24
# make config-recursive
===> Setting user-specified options for apache24-2.4.26 and dependencies
接下來一一勾選相依套件的選項後
# make insall clean
即可
- Jul 03 Mon 2017 15:31
freebsd 出現 You have security/openssl installed but do not have DEFAULT_VERSIONS+=ssl=openssl set in your make.conf
如果你除了內建的openssl 又自行安裝比較新版的openssl
在安裝其他套件時出現以下警告訊息
/!\ WARNING /!\
You have security/openssl installed but do not have
DEFAULT_VERSIONS+=ssl=openssl set in your make.conf
解決方式
echo 'DEFAULT_VERSIONS+=ssl=openssl' >> /etc/make.conf
即可
- Jul 03 Mon 2017 13:41
顯示 memcached 狀態
[root@test] ~# echo stats | nc memcached-server 11211
STAT pid 16817
STAT uptime 181573
STAT time 1499060450
STAT version 1.4.4
STAT pointer_size 64
STAT rusage_user 186.459653
STAT rusage_system 581.109657
STAT curr_connections 12
STAT total_connections 163313
STAT connection_structures 71
STAT cmd_get 8260007
STAT cmd_set 811378
STAT cmd_flush 0
STAT get_hits 7935925
STAT get_misses 324082
STAT delete_misses 0
STAT delete_hits 1
STAT incr_misses 0
STAT incr_hits 0
STAT decr_misses 0
STAT decr_hits 0
STAT cas_misses 0
STAT cas_hits 0
STAT cas_badval 0
STAT auth_cmds 0
STAT auth_errors 0
STAT bytes_read 7135925788
STAT bytes_written 14480451759
STAT limit_maxbytes 2147483648
STAT accepting_conns 1
STAT listen_disabled_num 0
STAT threads 4
STAT conn_yields 0
STAT bytes 283099957
STAT curr_items 211892
STAT total_items 811378
STAT evictions 0
END
^C
- Jul 03 Mon 2017 12:08
紀錄 wget 抓網頁過程
wget -R jpg,gif,css,js -r -l 2 --delete-after http://myip.pass.tw/ | & tee wget.log
-R: 排除某些檔案不抓
-r: 遞迴抓取網頁
-l: 抓到第幾層
--delete-after: 移除暫存網頁
網站擷取:使用Python
Web Scraping with Python
作者: Ryan Mitchell
譯者:Studio Tib.
出版社:歐萊禮
出版日期:2016/10/03
語言:繁體中文
- Jun 28 Wed 2017 10:15
解決nginx+php-fpm : FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream 錯誤訊息
安裝好nginx + php-fpm 後,ngixn error log出現以下錯誤訊息
2017/06/28 10:06:46 [error] 949#100116: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 192.168.77.252, server: ng.test.com, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "example.com:8080"
預設參考範例
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}
修改為以下設定
location ~ \.php$ {
#root html;
root "你的網頁路徑";
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
重新啟動nginx 即可
MIS 一定要懂的82個伺服器建置與管理知識
作者: きはし まさひろ
譯者: 陳禹豪, 黃瑋婷
出版社:旗標
- Jun 27 Tue 2017 14:08
清除varnish 某個cache資料
varnishadm
ban req.http.host == "example.com" && req.url ~ "\.png$"
- Jun 19 Mon 2017 12:17
【2017/6/20 MUJI無印良品x博客來 開館8週年慶 不限金額結帳81折】
- Jun 19 Mon 2017 09:32
【2017/6/20 MUJI無印良品x博客來 開館8週年慶 不限金額結帳81折】
- Jun 16 Fri 2017 16:18
Apple iPhone/iPad接有線網路
雖然說4G網路或是wifi 少了接線,方便許多
但有些時候我們需要一個比較穩定的網路品質,比如說直播需求
就建議設備接上有線的網路
為 apple iphone , ipad 接上有線網路
可以先準備一個 Apple lightning to usb 轉接器
USB 隔壁也提供lightning 孔可以供手機或平板充電,不用擔心上網時太過耗電
另外再自備一條 usb to RJ45 網路卡即可
接好線路後在設定的功能中即可出現Ethernet選項
最後測試一下網路,真的是走有線出去,耶...收工
http://myip.pass.tw/
最近發現 apple 網站有賣這個東西,但沒測試過也已經沒貨了
Belkin 乙太網路 + 電源轉接器 (配備 Lightning 連接器)
NT$3,290
- Jun 08 Thu 2017 17:28
rsync 只監聽特定IP
假設我們的rsync server 有兩張網卡
一張對外、一張對內
如果rsync 的服務只需要對內,不希望外面的人來打擾
當然可以用防火牆來阻擋
但如果不方便用防火牆的話
也可以透過修改設定檔來達成
如果是獨立執行的
參考一下man 說明
address
You can override the default IP address the daemon will listen
on by specifying this value. This is ignored if the daemon is
being run by inetd, and is superseded by the --address com-
mand-line option.
可以修改 rsyncd.conf
address = 要LISTEN的IP
如果是透過xinetd 啟動的
可以修改 /etc/xinetd.d/rsync
加入 bind = 要LISTEN的IP
或是考慮其他參數
如
only_from 或是 only_from
- Jun 07 Wed 2017 17:25
freebsd 安裝 drupal 8
cd /usr/posts/www/drupal8
make install
基本上只要一直下一步即可完成安裝流程
安裝完後會出現apache 及php 的建議設定
用Drupal輕鬆架出商業網站:網路商店╳報名平台╳預約系統╳拍賣平台
- Jun 02 Fri 2017 10:32
判斷不同國家轉址到當地web server 使用mod_geoip+rewrite
如果經營一個跨國網站
想要針對不同國家來的客戶,呈現出客製化的內容、語系
或是想要導到當地比較的機房
可以利用apache + mod_geoip + rewrite 來實現
安裝 GeoIP
cd /usr/ports/net/GeoIP
make install
GeoIP資料庫預設會放在 /usr/local/share/GeoIP
剛安裝完後是空的,必須執行已下指令下載資料庫
/usr/local/bin/geoipupdate.sh
也可以將這個指令放入crontable排程中,定時更新資料庫
crontab -e
0 0 1 * * /usr/local/bin/geoipupdate.sh
之後便下載以下兩個檔案
-r--r--r-- 1 root wheel 1.0M 5 3 05:30 GeoIP.dat
-r--r--r-- 1 root wheel 1.9M 5 3 05:30 GeoIPv6.dat
安裝 mod_geoip
cd /usr/ports/www/mod_geoip2
make install
編輯apache設定
vi /usr/local/etc/apache22/httpd.conf
LoadModule geoip_module libexec/apache22/mod_geoip.so
Include etc/apache22/extra/geoip.conf
vi /usr/local/etc/apache22/extra/geoip.conf
<IfModule mod_geoip.c>
GeoIPEnable On
GeoIPDBFile //usr/local/share/GeoIP/GeoIP.dat
</IfModule>
重啟apache
apachectl restart
編輯rewrite rule ,如果是美國來的ip則轉址到美國網站
vi .htaccess
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mybox.tw$ [NC]
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^US$
RewriteRule ^(.*)$ http://us.mybox.tw/$1 [L,R]
Python新手使用Django架站的16堂課:
活用Django Web Framework快速建構動態網站
作者: 何敏煌
出版社:博碩
- May 23 Tue 2017 16:07
CentOS 安裝 openssl + wget
下載原始檔案
https://www.openssl.org/source/
http://ftp.gnu.org/gnu/wget/
tar -zxpBvf openssl-1.0.2k.tar.gz
cd openssl-1.0.2k
./config
make
make test
make install
檢查openssl 版本
/usr/local/ssl/bin/openssl version
OpenSSL 1.0.2k 26 Jan 2017
tar -zxpBvf wget-1.19.1.tar.gz
cd wget-1.19.1
./configure --with-ssl=openssl --with-libssl-prefix=/usr/local/ssl
make
make install
收工
- May 19 Fri 2017 16:06
將linux 產生的 id_rsa 轉換成 windows putty 可以用的 *.ppk
如果真的必須要把 linux 暴露在 internet 上
使用 ssh key 登入某種程度來說要比帳號密碼驗證來的安全多
我們可以藉由修改 /etc/ssh/sshd_config 關閉密碼驗證來限制只允許使用 ssh key 登入
PasswordAuthentication no
修改完後記得重新啟動 sshd
在 linux 上可以簡單用 ssh-keygen 產生 id_rsa
並且用 ssh-copy-id 把 authorized_key 送上遠端 server: ~user/.ssh/ 中
但是如果要在一台 windows client 透過 putty 的話
就要先下載 puttygen
1. 開啟 putty key generator
2. 點選上方 conversions - import key
3. 選擇 linux ssh-keygen 產生的 id_rsa
4. 如果有密碼的話,輸入密碼
5. save private key
鳥哥的Linux私房菜:伺服器架設篇(第三版)(附光碟)
- May 11 Thu 2017 14:54
curl 檢視網頁 http headers
curl --help
-I, --head Show document info only
# curl -I http://myip.pass.tw/
HTTP/1.1 200 OK
Date: Thu, 11 May 2017 06:52:20 GMT
Server: Apache/2.2.15 (CentOS)
X-Powered-By: PHP/5.3.3
Connection: close
Content-Type: text/html; charset=UTF-8
圖解HTTP
- May 10 Wed 2017 16:22
[食記] 延吉八德路口-鷹流東京醬油拉麵-蘭丸
延吉八德路口,這間鷹流東京醬油拉麵
每天到用餐時間一定大排長龍
所以每次經過都無緣品嘗
今天中午不曉得是天氣太熱還是怎樣,排隊人不多
所以就進來嘗鮮一下
排隊前請先到門口前販賣機購買餐券
如果是第一次來,建議排隊的時候先閱讀一下店長的溫馨提醒
店內的蘭丸特製玉子是良心自由價,就看客官隨意啦
玉子就擺在工作臺上,等待的同時可以嘗試看看
投錢後就自由取用,好吃
有誠意的滿滿叉燒,如果吃不飽可以加麵加湯不加價
可以選擇加半碗也就是一球,或是一碗麵也就是兩球麵
原則是可以吃完為原則,千萬不要浪費食材
用餐完畢後,請將餐具自助回收到餐檯上
隨手拿桌上的抹布將用餐的位置稍微擦拭一下即可
地點在八德延吉路口,台北市延吉路2號
中崙市場旁
檢視較大的地圖
拉麵聖經
Ramen Noodle Cookbook
- May 10 Wed 2017 10:25
限制理論(TOC) 改善系統效能
限制理論(Theory of Constraints,TOC)是由以色列學者伊利雅胡·高德拉特(Eliyahu M. Goldratt)所發展出來的一種全方面的管理哲學,
主張一個複雜的系統隱含著簡單化。即使在任何時間,一個複雜的系統可能是由成千上萬人和一系列設備所組成。
但是只有非常少的變數或許只有一個,稱為限制,它會限制(或阻礙)此系統達到更高的目標。(節錄wiki)
常聽說,處理問題不能頭痛醫頭,腳痛醫腳
但我說,在TOC的領域,如果診斷出來是頭痛,跑去醫腳,整體系統效能還是卡在那邊
以下是TOC中如何改善系統流程中的五個步驟
一、找出系統的瓶頸。
二、決定如何利用瓶頸。
三、根據上述的決定,調整其他的一切。
四、把系統的的瓶頸鬆綁。
五、假如步驟四打破了系統原有的瓶頸,那麼就回到步驟一。
如此五個步驟不斷循環,主要精神在於"持續改善"
假設今天你營運一個線上網站發現效率不彰,無法達到企業設定的目標
想要改善他的效能
1. 首先要知道,使用者瀏覽一個網站,從發出需求到回傳顯示結果需要通過多少關卡
例如: 網路頻寬、程式設計邏輯、CPU、記憶體、資料庫、I/O效能... bla bla
根據這些關卡找出系統的瓶頸在哪裡
2. 如果已經知道系統的瓶頸,我們就要讓他盡可能的把自己的效能發揮到極致
必要的話可以把負擔轉嫁到其他非瓶頸資源上
3. 有了上個步驟的共識後,就是要求全員配合,改善這個流程
如果是資料庫效能問題
DBA 嘗試調校參數,改善index
系統工程師協助改善CPU/RAM/IO 等硬體規格
重新規劃系統架構,如多層式、附載平衡、主從分離、cluster .... 等等等
程式設計師配合dba改寫sql 查詢語法
4. 組織內全力配合流程3的結論,將瓶頸鬆綁,讓瓶頸不再是瓶頸
如果有按照預期的計畫,此刻瓶頸應該會轉移到其他關卡
5. 調整系統難免會經歷磨合期,當系統穩定後,重新回到步驟1
如此不斷的持續改善
再來看看vmware的資源共享
即便是硬體資源有限,管理員也可以靈活的調整每個guestos 所分配到的資源
讓每個服務都可以用適合的資源來達到整體最大的產出
目標:簡單有效的常識管理(十萬冊硬殼精裝版)
The Goal: A Process of Ongoing Improvement
- May 08 Mon 2017 17:49
嬰兒洗澡水溫
一般來說,嬰兒洗澡的水溫建議在 37~40 之間
為了不讓寶寶過冷或是過熱
可以買一支水溫計來測量喔
chicco小河豚沐浴溫度計-淺藍
PIGEON 貝親 水溫計(小熊)
PIGEON 貝親 水溫計(海豹)
- May 04 Thu 2017 15:23
varnishlog 指令,debug 時很好用
varnish 是一個高效能的 reverse proxy server
假設我要觀察瀏覽器連到 varnish server 的 /abc/ 路徑時,會做的動作
可以下以下指令
varnishlog -c -m 'RxURL:^/abc/$'
- Apr 28 Fri 2017 15:08
國家地理《世紀天才》愛因斯坦 第一集 YouTube 7天免費收看
國家地理《世紀天才》第一集 YouTube 7天免費收看
別錯過越來越精采的《世紀天才》全新集數,每週一晚上10點首播!週二早上11點、週三晚上11點、週六晚上9點重播。
《世紀天才》探討了著名物理學家阿爾伯特愛因斯坦動盪的人生旅程。個性獨立、聰明過人、永遠充滿好奇心的愛因斯坦改變了我們對宇宙的看法,而這個系列將會改變我們對愛因斯坦的看法。本系列一共分為十集,介紹了愛因斯坦在學術界起步時的失敗和後來的成就,和他追求愛和人性連結的過程,讓觀眾看到愛因斯坦複雜的真面目。
相對論,愛因斯坦教會我們什麼?:圖解20世紀最偉大的科學理論(暢銷新裝版)
マンガでわかる相対性理論 光の速さで飛んだらどうなる?相対性理論のたった2つの結論とは?
作者: 新堂進/著, 二間瀨敏史, 傅昭銘/審訂
譯者:陳威丞
出版社:美藝學苑社
出版日期:2017/03/03
語言:繁體中文
定價:280元