下載 nginx web server
http://nginx.org/en/download.html
設定檔: nginx.conf 放在 nginx/conf
docroot 一般設定在 nginx/html
讓 php-cgi 可支援, 修改 nginx.conf,加入以下內容:
location ~ .php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
如果要支援 drupal,修改 nginx.conf,加入以下內容:
location /drupal {
index index.php index.html index.htm;
if (!-e $request_filename) {
rewrite ^(.+)$ /drupal/index.php?q=$1 last;
}
}
如果要支援 wordpress , 修改 nginx.conf
location /wordpress {
index index.php index.html index.htm;
if (!-e $request_filename) {
rewrite ^(.+)$ /wordpress/index.php?q=$1 last;
}
}
如果要使用 sqlite 資料庫, 則到 wordpress 官網下載 pdo_sqlite plugin, 並將此plugin 模組放入 wp-content 目錄下, 另外需修改 wp-config.php, 加入以下的程式碼:
define('DB_TYPE','sqlite');
Drupal 7 才開始有支援 php data object (PDO) 的 slite 資料庫 (pdo_sqlite),
但我用起來不是很穩, 看起來 drupal7 與 nginx 相容性友有待驗證
須修改 php.ini 的 extension 設定值, 將以下的 extension enable:
extension=php_curl.dll
extension=php_gd2.dll
extension=php_mysql.dll
extension=php_pdo_mysql.dll
extension=php_pdo_sqlite.dll
將 nginx 檔案全部放入 c:\nginx
將 php 檔案全部放入 c:\nginx\php
啟動 nginx
start c:\nginx\nginx.exe
命令 php-cgi listen port 9000
start c:\nginx\php\php-cgi.exe -b 127.0.0.1:9000 -c c:\nginx\php\php.ini
2010年10月8日 星期五
2010年10月3日 星期日
安裝 Ubuntu 到 SD 卡上
1. 先安裝 boot loader , 我習慣用 grub, grub 也是 ubuntu 內建的 boot loader
2. 將 SD 分割好, 我習慣將 partition 1 設成 FAT, 將 partition 2 設成 linux, 務必確認 SD 卡所在的磁碟機, 一般來說, 開機碟是 hd0, 第二個是 hd1, 我的 SD 卡是在 hd1, 可以利用 grub 內建指令搜尋檔案所在位置
先使用 Ubuntu Linux 開機:
再取得 Ubuntu 的 root 控制權
\UbuntuLinux>sudo su
使用 fdisk 分割 SD 卡, 例如 sdb1(FAT 06), sdb2(Linux 83)
\UbuntuLinux>fdisk /dev/sdb
....
參考命令: n, a, t, l, m
....
\UbuntuLiux>cd /mnt
將 partition 2 格式化成 Linux
\UbuntuLinux\mnt>mke2fs /dev/sdb2
建立 grub 所需資料夾:
\UbuntuLinux\mnt>mkdir sdb
\UbuntuLinux\mnt>mount /dev/sdb2 sdb
\UbuntuLinux\mnt>mkdir sdb/boot
\UbuntuLinux\mnt>mkdir sdb/boot/grub
將 grub 所需的檔案存入 /mnt/sdb/boot/grub 內: stage1, stage2, stage1_5..., menu.lst
\UbuntuLinux\mnt>cp ... /mnt/sdb/boot/grub
修改 /boot/grub/ment.lst 內容
\UbuntuLinux\mnt>vi sd/boot/grub/menu.lst
將Ubuntu 的 iso 檔(例如 Ubuntu10.04.iso ) 放在 partition 1 (hd0,0) 的 capser 目錄下,
Ubuntu 10 的 linux kernel 名稱叫作 vmlinuz, ramdisk 名稱叫作 initrd.lz, 一般來說,都放在 cdrom 的 casper 目錄內, 可以將他複製到 SD 卡上的 partition 1 (FAT) 內,只要在 menu.lst 明確設定好 kenrel 及 ininrd 所在位置即可
...
default=0
timeout=2
root (hd0,0)
kernel /casper/vmlinuz boot=casper iso-scan/filename=/casper/ubunt10.04.iso ro splash locale=zh_TW.UTF-8
initrd /casper/initrd.lz
...
卸載 SD 卡, 並執行 grub 安裝 boot loader
\UbuntuLinux\mnt>umount sdb
\UbuntuLinux\mnt>grub
在 grub 內設定好 root device, 以便讓它去找尋 stage1, stage2, stage1_5, menu.lst 所在磁碟
\grub>root (hd1,1)
並確認 root device 所在磁碟: 例如將 id 存入在 /mnt/sdb/boot/grub/id , 則執行以下命令:
\grub>find /boot/grub/id
安裝 grub 到 SD 卡 MBR
\grub>setup (hd1)
\grub>quit
重新開機並設定 BIOS 讓 SD 卡可以啟動開機
2. 將 SD 分割好, 我習慣將 partition 1 設成 FAT, 將 partition 2 設成 linux, 務必確認 SD 卡所在的磁碟機, 一般來說, 開機碟是 hd0, 第二個是 hd1, 我的 SD 卡是在 hd1, 可以利用 grub 內建指令搜尋檔案所在位置
先使用 Ubuntu Linux 開機:
再取得 Ubuntu 的 root 控制權
\UbuntuLinux>sudo su
使用 fdisk 分割 SD 卡, 例如 sdb1(FAT 06), sdb2(Linux 83)
\UbuntuLinux>fdisk /dev/sdb
....
參考命令: n, a, t, l, m
....
\UbuntuLiux>cd /mnt
將 partition 2 格式化成 Linux
\UbuntuLinux\mnt>mke2fs /dev/sdb2
建立 grub 所需資料夾:
\UbuntuLinux\mnt>mkdir sdb
\UbuntuLinux\mnt>mount /dev/sdb2 sdb
\UbuntuLinux\mnt>mkdir sdb/boot
\UbuntuLinux\mnt>mkdir sdb/boot/grub
將 grub 所需的檔案存入 /mnt/sdb/boot/grub 內: stage1, stage2, stage1_5..., menu.lst
\UbuntuLinux\mnt>cp ... /mnt/sdb/boot/grub
修改 /boot/grub/ment.lst 內容
\UbuntuLinux\mnt>vi sd/boot/grub/menu.lst
將Ubuntu 的 iso 檔(例如 Ubuntu10.04.iso ) 放在 partition 1 (hd0,0) 的 capser 目錄下,
Ubuntu 10 的 linux kernel 名稱叫作 vmlinuz, ramdisk 名稱叫作 initrd.lz, 一般來說,都放在 cdrom 的 casper 目錄內, 可以將他複製到 SD 卡上的 partition 1 (FAT) 內,只要在 menu.lst 明確設定好 kenrel 及 ininrd 所在位置即可
...
default=0
timeout=2
root (hd0,0)
kernel /casper/vmlinuz boot=casper iso-scan/filename=/casper/ubunt10.04.iso ro splash locale=zh_TW.UTF-8
initrd /casper/initrd.lz
...
卸載 SD 卡, 並執行 grub 安裝 boot loader
\UbuntuLinux\mnt>umount sdb
\UbuntuLinux\mnt>grub
在 grub 內設定好 root device, 以便讓它去找尋 stage1, stage2, stage1_5, menu.lst 所在磁碟
\grub>root (hd1,1)
並確認 root device 所在磁碟: 例如將 id 存入在 /mnt/sdb/boot/grub/id , 則執行以下命令:
\grub>find /boot/grub/id
安裝 grub 到 SD 卡 MBR
\grub>setup (hd1)
\grub>quit
重新開機並設定 BIOS 讓 SD 卡可以啟動開機
2010年9月29日 星期三
免費又好用的工具程式
好用的看圖軟體及編修工具: http://www.xnview.com/en/download.html
好用的文字檔編輯工具: http://notepad-plus-plus.org/download
好用的數學軟體: http://freemat.sourceforge.net/
另一款數學軟體: http://www.gnu.org/software/octave/download.html
好用的 HTML 編輯軟體: http://kompozer.net/
好用的 ftp 軟體: http://filezilla-project.org/
好用的 sshd http://www.freesshd.com/?ctt=download
好用的 ssh client: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
好用的虛擬電腦: http://www.virtualbox.org/wiki/Downloads
好用的解壓縮軟體 http://www.7-zip.org/
好用的加密軟體 http://www.truecrypt.org/downloads
好用的遠端遙控軟體: http://www.realvnc.com/products/download.html
好用的燒錄軟體http://www.imgburn.com/index.php?act=download
好用轉 PDF 工具: http://sourceforge.net/projects/pdfcreator/
好用的 p2p 軟體: http://www.utorrent.com/
好用的文字檔編輯工具: http://notepad-plus-plus.org/download
好用的數學軟體: http://freemat.sourceforge.net/
另一款數學軟體: http://www.gnu.org/software/octave/download.html
好用的 HTML 編輯軟體: http://kompozer.net/
好用的 ftp 軟體: http://filezilla-project.org/
好用的 sshd http://www.freesshd.com/?ctt=download
好用的 ssh client: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
好用的虛擬電腦: http://www.virtualbox.org/wiki/Downloads
好用的解壓縮軟體 http://www.7-zip.org/
好用的加密軟體 http://www.truecrypt.org/downloads
好用的遠端遙控軟體: http://www.realvnc.com/products/download.html
好用的燒錄軟體http://www.imgburn.com/index.php?act=download
好用轉 PDF 工具: http://sourceforge.net/projects/pdfcreator/
好用的 p2p 軟體: http://www.utorrent.com/
2010年9月26日 星期日
Windows sshd
1. 下載
free SSH Server: http://www.freesshd.com/
free SSH Client: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
2. 安裝 freesshd, 設定:
Users TAB: 增加 user, 設定密碼, 使用 Password stored as SHA1 hash,並勾選 Shell, SFTP, Tunnling
Tunneling TAB: 勾選 Allow local port forward, 並勾選 Allow remote forwarding
其他使用內定值即可
3. 安裝 putty
設定 SSH/Tunnels,
增加 Source port (將使用 127.0.0.1:SorcePort 來存取), 要連線的 host 及 port: DestinationIP:DestinationPort
4. 開啟防火牆設定,令其可通過防火牆
free SSH Server: http://www.freesshd.com/
free SSH Client: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
2. 安裝 freesshd, 設定:
Users TAB: 增加 user, 設定密碼, 使用 Password stored as SHA1 hash,並勾選 Shell, SFTP, Tunnling
Tunneling TAB: 勾選 Allow local port forward, 並勾選 Allow remote forwarding
其他使用內定值即可
3. 安裝 putty
設定 SSH/Tunnels,
增加 Source port (將使用 127.0.0.1:SorcePort 來存取), 要連線的 host 及 port: DestinationIP:DestinationPort
4. 開啟防火牆設定,令其可通過防火牆
2010年9月25日 星期六
安裝 phpBB (電子布告欄)討論區
到官方網站下載
1. phpBB 主程式及中文語系相關檔案: http://www.phpbb.com/downloads/olympus.php
2. language pack 共有 3 個檔案需要下載: http://www.phpbb.com/languages/
Language, subsilver2, proSilver 等 3 個壓縮檔
3. 參考竹貓星簡易安裝法: http://phpbb-tw.net/phpbb/viewtopic.php?f=116&t=50303
4. 將上述檔案解壓縮放到 Web server 適當目錄底下: ./phpBB3
5. 執行 mysql client, 產生新資料庫, 並將資料庫權限設好管理員帳號及密碼
6. 利用瀏覽器訪問 http://.../phpBB3/install/index.php
7. 將 資料庫名稱, 管理員帳號, 管理員密碼, 輸入
8. 移除 ./phpBB3/install 目錄
9. 完成
10.開始管理版面
1. phpBB 主程式及中文語系相關檔案: http://www.phpbb.com/downloads/olympus.php
2. language pack 共有 3 個檔案需要下載: http://www.phpbb.com/languages/
Language, subsilver2, proSilver 等 3 個壓縮檔
3. 參考竹貓星簡易安裝法: http://phpbb-tw.net/phpbb/viewtopic.php?f=116&t=50303
4. 將上述檔案解壓縮放到 Web server 適當目錄底下: ./phpBB3
5. 執行 mysql client, 產生新資料庫, 並將資料庫權限設好管理員帳號及密碼
6. 利用瀏覽器訪問 http://.../phpBB3/install/index.php
7. 將 資料庫名稱, 管理員帳號, 管理員密碼, 輸入
8. 移除 ./phpBB3/install 目錄
9. 完成
10.開始管理版面
Apache2 一些資訊
啟用 Directory 時, 其內部選項是會被其子目錄所繼承的, 但後續的相同的 directive 可以改寫,蓋掉前面之敘述
(A) 策略 1: 先嚴格禁止,在慢慢開放,
在根目錄先用 AllowOverride None, 其底下目錄, 接下來如沒有特別指定,則預設是關閉 Override:
AllowOverride None
Order deny,all
deny from allow
(A) 策略 2: 先全部開放, 再一一禁止
在根目錄先用 AllowOverride All, 其底下目錄, 接下來如沒有特別指定,則預設是開啟 Override:
AllowOverride All
Order allow,deny
allow from all
... : path 使用絕對路徑
只作用在此目錄內, path 欄可以使用 Regex 語法, 包含 ~ 符號, regular expression 使用 "" 括起來
例:
Options Indexes FollowSymLinks
AllowOverride --> 只存在於 內
Ubuntu 的 Appach 設定會 include /etc/apache2/sites-enabled/000-default
在此他會將 DocumnentRoot,AllowOverride 重新改寫,
Options: ALL, ExecCGI , FollowSymLinks, Includes, IncludesNOEXEC, Indexes, Multiviews, SymLinksIfOwnerMatch
FollowSymLinks : Apache2 是否會遵循 Symbolic link
Indexes : 要不要顯示目錄裡的內容
(A) 策略 1: 先嚴格禁止,在慢慢開放,
在根目錄先用 AllowOverride None, 其底下目錄, 接下來如沒有特別指定,則預設是關閉 Override:
AllowOverride None
Order deny,all
deny from allow
(A) 策略 2: 先全部開放, 再一一禁止
在根目錄先用 AllowOverride All, 其底下目錄, 接下來如沒有特別指定,則預設是開啟 Override:
AllowOverride All
Order allow,deny
allow from all
只作用在此目錄內, path 欄可以使用 Regex 語法, 包含 ~ 符號, regular expression 使用 "" 括起來
例:
Options Indexes FollowSymLinks
AllowOverride --> 只存在於
Ubuntu 的 Appach 設定會 include /etc/apache2/sites-enabled/000-default
在此他會將 DocumnentRoot,AllowOverride 重新改寫,
Options: ALL, ExecCGI , FollowSymLinks, Includes, IncludesNOEXEC, Indexes, Multiviews, SymLinksIfOwnerMatch
FollowSymLinks : Apache2 是否會遵循 Symbolic link
Indexes : 要不要顯示目錄裡的內容
訂閱:
文章 (Atom)