我是武男, 24歲, 大家都叫我阿男...有的人還會叫我白目研究生...找我的話請Google "武男" 就沒錯了~

PHP-Dorm Project階段整理

Autor 白目研究生 | 28.07.2008 | Category FreeBSD, 武男亂講

用了APPSERV2.6部署

[sourcecode language='php']
getdate();
[/sourcecode]

看到了這樣子的問題

Strict Standards: getdate() [function.getdate]: It is not safe to rely on the system’s timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘UTC’ for ‘8.0/no DST’ instead in .\AppServ\www\modify.php on line 1

看樣子應該會有SET的方法設定時區

可以改成這樣

[sourcecode language='php']
date_default_timezone_set(“Asia/Taipei”);
echo strftime(“%Y-%m-%d %H:%M:%S”);
[/sourcecode]

參考資料:這裡

其他相關時間設定參數

才發現原來台灣一直不適用Etc/GMT+8

似乎要用

asia/taipei

這下子誤會大了…

然後還要看一下SNMP MIB TREE

又快又上手的,就是GetIf

以上

FreeBSD-PPPoE on FreeBSD How To

Autor 白目研究生 | 11.04.2008 | Category FreeBSD

最近替學弟上課討論的議題

就是有人在家裡的網路環境沒有辦法使用PPPoE連上網路

今天就trace把steps一起做一做了…

根據6.0-RC到7.0-RC的經驗

系統會在下面直接內建一個ppp的目錄

倒好,省了安裝套件的麻煩

確認一下下面資訊

a# pwd
/etc/ppp
a# ifconfig
le0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=8<VLAN_MTU>
ether 00:0c:29:e2:ce:a2
inet 192.168.1.111 netmask 0xffffff00 broadcast 192.168.1.255
media: Ethernet autoselect
status: active
plip0: flags=108810<POINTOPOINT,SIMPLEX,MULTICAST,NEEDSGIANT> metric 0 mtu 1500
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
inet6 fe80::1%lo0 prefixlen 64 scopeid 0×3
inet6 ::1 prefixlen 128
inet 127.0.0.1 netmask 0xff000000

先確認網路介面與目前路徑後

開始改設定

a# vi ppp.conf

default:
set log Phase Chat LCP IPCP CCP tun command
nat enable yes
nat same_ports yes
nat use_sockets yes
set redial 15 28800
set reconnect 15 28800

pppoe:           #dial name plz remeber!!
set device PPPoE:le0:   #change to u’re interface name!!
set mru 1492
set mtu 1492
set speed sync
enable lqr
set lqrperiod 5
set cd 5
set dial
set login
set timeout 0
set authname        #PPPoE Username
set authkey         #PPPoE Password
set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.0 0.0.0.0
add default HISADDR
enable dns
# end of ppp configuration

改完就可以下指令連線了

a# ppp -ddial pppoe
Loading /lib/libalias_cuseeme.so
Loading /lib/libalias_ftp.so
Loading /lib/libalias_irc.so
Loading /lib/libalias_nbt.so
Loading /lib/libalias_pptp.so
Loading /lib/libalias_skinny.so
Loading /lib/libalias_smedia.so
Working in ddial mode
Using interface: tun0
a#ifconfig
le0: flags=8843 metric 0 mtu 1500
options=8
ether 00:0c:29:e2:ce:a2
inet 192.168.1.111 netmask 0xffffff00 broadcast 192.168.1.255
media: Ethernet autoselect
status: active
plip0: flags=108810
metric 0 mtu 1500
lo0: flags=8049 metric 0 mtu 16384
inet6 fe80::1%lo0 prefixlen 64 scopeid 0×3
inet6 ::1 prefixlen 128
inet 127.0.0.1 netmask 0xff000000
tun0: flags=8051 metric 0 mtu 1492
inet 218.172.146.23 –> 220.143.32.254 netmask 0xffffff00
Opened by PID 751

這樣子就算完成了

刪除?!斷開連線?!

直接把ppp的process kill就可以了

a# ps -aux | grep ppp
root 751 0.0 1.0 4984 2564 ?? Ss 3:53AM 0:03.84 ppp -background
root 918 0.0 1.0 4984 2556 ?? Ss 4:20AM 0:00.47 ppp -ddial pppoe
a# kill -9 751 918

ref:http://twbsd.org


開機自動連線呢?!

白目研究生:學弟,學長不是這樣子操的…

FreeBSD-ZFS the new file system on bsd like

Autor 白目研究生 | 11.04.2008 | Category FreeBSD, 技術文件

不是新聞了

可是我昨天才知道

而且也找不到ZFS的全名…(汗)

簡易使用手冊

http://www.solarisinternals.com/wiki/index.php/ZFS_Best_Practices_Guide

http://wiki.freebsd.org/ZFS

下面是直接轉的紀錄…

所以應該可以不用好奇的點下去了…

XDD


NetCache Appliance 好貴好不會用…XDD

(FreeBSD & uBuntu)Kernel Upgrade 比一比

Autor 白目研究生 | 15.02.2008 | Category FreeBSD, uBuntu, 技術文件

今天難得SA學長發群組信

偏偏兩種OS的Server手邊都剛好有…

就開始Upgrade的不歸路了…

繼續閱讀後都是繁雜的steps…

Apache DocumentRoot on NFS How To

Autor 白目研究生 | 27.09.2007 | Category FreeBSD, 技術文件

這次的需求如下,家裡面NAT底下有兩台機器:

FreeNAS:File Server on FreeBSD support CIFS、FTP

Web Server:Appserv 2.5.9 on Windows XP support Web、Ftp service

第一個版本的架構如下(理想的理論):

Web Server建立CIFS的連線磁碟機(Z:\),後把Aappserv的DocumentRoot指到網路磁碟機上。

也就是所有的網頁目錄都會被建立在FreeNAS上,而 Web Server則只是個跳板,除了一般的IPTable安全性設置,相關網頁目錄存取權限,則是被FreeNAS監控。

But

Appserv的httpd.conf 設定上可沒那麼好說話,單純設定“DocumentRoot “\\CIFS IP or Z:\”

就會出現設定檔的字元是不合法的“The Requested Operation Has Failed!”的訊息提示,並且不允許重新啟動httpd的process

今天詢問ychsiao長輩的結果:阿就,Windows才會這樣阿,換掉換掉。

Salamand長輩:對阿,真奇怪,17:00跟5:00 PM明明就一樣阿,怎麼會少了兩個小時。38l34mor5

找了一下,在Windows底下安裝NFS Service,有沒有這麼麻煩,我看還是算了。0m618aako

後來實際測試,確定可行的架構就變成了這樣子

FreeNAS:File Server on FreeBSD support CIFS、FTP、NFS

Web Server:Web Server on FreeBSD support 要什麼有什麼

在FreeBSD底下要使用NFS service 的環境是需要NFS Client的,可以透過下面方式啟動。

在/etc/rc.conf底下設定開機啟動nfs client與rpc

nfs_client_enable=”YES”
#nfs_server_enable=”YES”
nfs_client_flags=”-n 4″ # Flags to nfsiod (if enabled)
nfs_access_cache=”2″ # Client cache timeout in seconds:00 des Exp $
#nfs_server_flags=”-u -t -n 8″ # Flags to nfsd (if enabled).#
rpc_lockd_enable=”NO” # Run NFS rpc.lockd needed for client/server.
rpc_statd_enable=”YES” # Run NFS rpc.statd needed for client/server.
rpcbind_enable=”YES” # Run the portmapper service (YES /NO).

之後,檢查FreeNAS share出來的檔案目錄

#showmount -e FreeNA_IP

可以得到以下資料Table

Exports list on FreeNA_IP:
/mnt/MASTER 210.71.23.0

用下面指令把NFS目錄mount 在Web Server上

#mount -t nfs 210.71.11.227:/mnt/sharename /mnt

如果要解除這個目錄的話,只要#umount /mnt 這樣子就可以了

接著就是#mount 檢查NFS目錄有沒有被掛上去

會看到下面info

/dev/da0s1a on / (ufs, local)
devfs on /dev (devfs, local)
/dev/da0s1g on /home (ufs, local, soft-updates)
/dev/da0s1f on /tmp (ufs, local, soft-updates)
/dev/da0s1d on /usr (ufs, local, soft-updates)
/dev/da0s1e on /var (ufs, local, soft-updates)
devfs on /var/named/dev (devfs, local)
Jupiter:/vol/freebsd on /nas (nfs)

確定有mount起來就可以開始編輯httpd.conf的設定了

#ee httpd.conf

add DocumentRoot “/mnt”

之後restart apache就可以看到測試了,不過你會先看到You don’t have permission to access / on this server.

這個就真的無解了,因為設定不知道為什麼會先讀到/這個目錄,不過可以修正httpd.conf解決這個問題

把下面通通註解掉即可

<Directory />
AllowOverride None
Order deny,allow
Deny from all
</Directory>

restart apache後就可以重新測試了。

參考資料:

http://turtle.ee.ncku.edu.tw/~ac/FreeBSD/50_NFS/nfs.html

http://www.bsdmap.com/mirrors/fanqiang/www.fanqiang.com/a1/b2/20010419/144107_b.html

http://docs.hp.com/zh_tw/B2355-90952/ch04s04.html

結論:阿就,Windows才會這樣阿,換掉換掉。