server{}
區塊 將 Sun WebServer 1.0 的 server{}
區塊轉換成 Sun WebServer 2.0 的格式相當簡單,因為 1.0 區塊內的大部份指引與 2.0 的完全相同,除了以下幾個之外:
acl_delegate_depth
Sun WebServer 已經不再支援 acl_delegate_depth
指引以及存取權控制代理的觀念,詳細說明請參閱本文件中「轉移 Sun WebServer 1.0 access.acl 檔案」之說明。
acl_enable
acl_enable
指引已經改成 access_enable
。
acl_enable
指引 在 /etc/http/httpd.conf 內搜尋下列 Sun WebServer 1.0 指引:
acl_enable yes |
將 /etc/http/server1.httpd.conf 中的這個指令換成以下指引:
access_enable yes |
acl_file
server{}
區塊內已經不再支援 acl_file
指引了,因為伺服器層級的存取權控制檔案已經換成: /etc/http/access.conf。此檔案的名稱不可更改。
對應
server{}
區塊內已經不再支援 map
指引。所有 URL 對應都必須在網站的 map.conf 檔案中加以設定。
mime_add
Sun WebServer 2.0 已經不再支援 mime_add
指引。所有 mime 類型都必須在伺服器或網站的 mime.types 檔案中加以指定。
mime_add
指令 假設要轉換以下的 Sun WebServer 1.0 指令:
server { mime_add "image/.jpeg" "JPG" } |
請確定 /etc/http/server1.httpd.conf 內已設定了 mime.types 檔案:
若此檔案是讓所有伺服器共同使用,則修改此檔案會影響所有執行中的 httpd 程式
server { mime_file "/etc/http/mime.types } |
在 /etc/http/mime.types 檔案內加入新的 MIME 對應:
image/jpeg JPG |
server{}
區塊轉換 假設要轉換以下的 Sun WebServer 1.0 在 /etc/http/httpd.conf 內的 server{}
區塊:
server { server_root "/var/http/demo/" server_user "root" mime_add "image/jpeg" "JPG" mime_default_type text/html acl_enable "yes" acl_file "/etc/http/access.acl" acl_delegate_depth 3 map /cgi-bin/ /var/http/cgi-bin/ cgi } |
修改 /etc/http/server1.httpd.conf 內的 server{}
區塊:
server { server_root "/var/http/demo/" server_user "http" mime_file "/etc/http/mime.types" mime_default_type text/html access_enable "yes" } |
將 MIME 對應加入已設定於 (2) 的 /etc/http/mime.types 檔案內:
image/jpeg JPG |