DNS Server

http://4271569.spaces.live.com/blog/cns!F1EA4F91324DA556!756.entry
CentOS v5.3-安裝 bind(DNS) / 新增網域名稱 / 每次開機就啟動 named
**Bind 的相關套件 ( DNS )
 .bind…………………………DNS 主程式
 .bind-chroot………………將 bind 主程式關在家理
 .bind-utils………………….用戶搜詢主機名稱的相關指令
 .system-config-bind
 .caching-nameserver

**安裝 bind,似 DNS 名稱解悉
**bind 的設定檔在 /var/named/chroot
# yum -y install bind bind-chroot bind-utlis system-config-bind caching-nameserver <-- 安裝套件。install 時不需再問全為 (y)es # cd /var/named/chroot/etc <-- 切換至 etc 目錄下 # cp named.caching-nameserver.conf named.conf <-- 覆製 named.caching-nameserver.conf,另存成 named.conf # ll <-- 觀察 named.conf 檔案權限, 此時應為 root root # chown root:named named.conf <-- 變更 named.conf 檔案權限 # ll <-- 觀察 named.conf 檔案權限, 此時應變稱為 root named # service named restart <-- 修改後需重新啟動,讓設定值生效。會先關畢,然後再啟動 # vi /var/named/chroot/etc/named.conf <-- 修改 named.conf 將 listen-on port 53 { 127.0.0.1; }; 修改成 listen-on port 53 { any; }; <-- 將127.0.0.1 改為 any,表示監聽所有 53 port 介面 將 allow-query { localhost; }; 修改成 allow-query { any; }; <-- 將 localhost 改為 any,表示允許外部來此台 dns 查詢 # service named restart <-- 修改後需重新啟動,讓設定值生效。會先關畢,然後再啟動 **新增 網域名稱 ◎假設網域名稱 ne160.kirnel.com  .新增加網域名稱 hello.ne160.kirnel.com  .新增加網域名稱 kitty.ne160.kirnel.com       ne160.kirnel.com ( 140.137.217.160 )           /       \          /         \         hello        kitty      ne160.kirnel.com  ne160.kirnel.com      140.137.217.160  140.137.217.160          |        | ┌-------- ┼- Apache -┼-------┐ | /opt/hello <┘        └> /opt/kitty | └-------------------------┘ # vi /var/named/chroot/etc/named.conf <-- 修改 etc 目錄下的 named.conf 檔 將 match-client { localhost; }; 修改成 match-client { any; }; 將 match-destinations { localhost; }; 修改成 match-destinations { any; }; # vi /var/named/chroot/etc/named.rfc1912.zones <-- 修改 named.rfc1912.zones 檔案 增加以下: zone "ne160.kirnel.com" IN { type master; file "ne160.zone"; allow-update { none; }; }; # cd /var/named/chroot/var/named # ll <-- 觀察是否有 ne160.zone # cp localhost.zone ne160.zone <-- 覆製 localhost.zone,另存成 ne160.zone # ll <-- 觀察 ne160.zone 檔案權限,此時應為 root root # chown root:named ne160.zone <-- 變更 ne160.zone 檔案權限 # ll <-- 觀察 ne160.zone 檔案權限,此時應變稱為 root named # vi /var/named/chroot/var/named/ne160.zone <-- 修改 ne160.zone,新增加 hello 及 kitty 網域 增加以下: hello  IN A  140.137.217.160 kitty  IN A  140.137.217.160 # service named restart <-- 修改完後,重新啟動 named。會先關畢,然後再啟動 **測試 # vi /etc/resolv.conf <-- 設定 DNS 增加以下: nameserver 168.95.1.1 # dig hello.ne160.kirnel.com @localhost <-- 使用本端機的 DNS,來查 hello.ne160.kirnel.com # dig hello.ne160.kirnel.com @168.95.1.1 <-- 使用中華電信的 DNS,來查 hello.ne160.kirnel.com # dig kitty.ne160.kirnel.com @localhost <-- 使用本端機的 DNS,來查 kitty.ne160.kirnel.com # dig kitty.ne160.kirnel.com @168.95.1.1 <-- 使用中華電信的 DNS,來查 kitty.ne160.kirnel.com **測試在 Windows 下使用 ping 指令  .ping hello.ne160.kirnel.com  .ping kitty.ne160.kirnel.com **建立 hello 及 kitty 網站目錄 # cd /opt <-- 切換至 /opt 目錄下,觀查有無 hello 及 kitty 目錄 # mkdir /opt/hello <-- 在 /opt 目錄下建立 hello 網站目錄 # mkdir /opt/kitty <-- 在 /opt 目錄下建立 kitty 的網站目錄 **建立網站內容文字 # echo "This is hello web." > /opt/hello/index.html <-- 在 hello 目錄下建立 index.html 檔案 # echo "This is kitty web." > /opt/kitty/index.html <-- 在 kitty 目錄下建立 index.html 檔案 **建立虛擬網站 # service httpd restart <-- 重新啟動。會先關畢,然後再啟動 # cd /etc/httpd/conf <-- 切換至 conf 目錄下 # vi httpd.conf 增加以下: NameVirtualHost 140.137.217.160:80
ServerAdmin hello@ne160.kirnel.com
DocumentRoot /opt/hello
ServerName hello.ne160.kirnel.com
ErrorLog /var/log/hello-error_log
CustomLog /var/log/hello-access_log common


ServerAdmin kitty@ne160.kirnel.com
DocumentRoot /opt/kitty
ServerName kitty.ne160.kirnel.com
ErrorLog /var/log/kitty-error_log
CustomLog /var/log/kitty-access_log common

# service httpd restart <-- 修改後,重新啟動。會先關畢,然後再啟動 **測試網站是否正確建立完成  .在 Windows 下開啟瀏覽器,在網址列內輸入 http://hello.ne160.kirnel.com  .在 Windows 下開啟瀏覽器,在網址列內輸入 http://kitty.ne160.kirnel.com **設定每次開機就啟動 named # chkconfig named on <-- 設定每次開機就啟動 named 功能 http://plus-now.com/?p=31

http://plus-now.com/?p=36

參考上述設定…

Google Storage Python API

到 Google Storage 申請帳號,過兩天收到認證信,開通以後填入信用卡帳號,就可以開始使用了,

先到 key management 申請一個 key ,然後抓 http://code.google.com/p/gsutil/ API 的函式庫,

然後用 Python 2.5 ~2.7 執行 gsutil ls 他就會幫你產生 .boto 設定檔 填入 剛申請的 key 跟 secret,就可以按照範例執行程式了。

#!/usr/bin/python

import StringIO
import os
import shutil
import tempfile
import time

import boto

# Read developer keys from the ~/.boto config file.
config = boto.config

# URI scheme for Google Storage.
GOOGLE_STORAGE = 'gs'
# URI scheme for accessing local files.
LOCAL_FILE = 'file'
now = time.time()
CATS_BUCKET = 'cats-%d' % now
DOGS_BUCKET = 'dogs-%d' % now

for name in (CATS_BUCKET, DOGS_BUCKET):
# Instantiate a BucketStorageUri object.
uri = boto.storage_uri(name, GOOGLE_STORAGE)
# Try to create the bucket.
try:
uri.create_bucket()
print 'Successfully created bucket "%s"' % name
except boto.exception.StorageCreateError, e:
print 'Failed to create bucket:', e

css 定位模型

最近覺得自己講話、描述越來越不清楚,所以想找幾個曾經沒足夠能力用口頭來描述的概念,用文章的方式重整一下自己的條理。

今天的主題是 css 定位模型,主要範例為此網站 http://www.barelyfitz.com/screencast/html-training/css/positioning/

他內容有十個 tab 幾乎將所有較可能發生的情況都舉了一次例子,所以是一個適合說明的範例。

我想要用兩種方式描述,一種是整理成簡短適合口頭介紹 定位模型的解釋。

另一種是完整定義清楚的解釋。 Continue reading…