以下の例は、Sun WebServer 1.0 の httpd.conf ファイルおよび access.acl ファイルの Sun WebServer 2.0 への完全変換を示します。以下の例では 2.0 の新しい指示語は、変換において明示的に必要でない限り、無視されます。
以下に示す Sun WebServer 1.0 の /etc/http/httpd.conf ファイルが存在すると仮定します。
server {
server_root "/var/http/demo"
server_user "root"
mime_file "/etc/http/mime.types"
mime_default_type text/html
acl_enable "yes"
acl_file "/etc/http/access.acl"
acl_delegate_depth 3
cache_enable "yes"
cache_small_file_cache_size 8
cache_large_file_cache_size 256
cache_max_file_size 1
cache_verification_time 10
map /cgi-bin/ /var/http/demo/cgi-bin/ cgi
map /sws-icons/ /var/http/demo/sws-icons/
mime_add "appication/java" class
mime_add "audio/basic" au
mime_add "audio/basic" snd
}
url {
doc_root "/var/http/demo/public"
user_doc_enable "no"
user_doc_root "public_html"
cgi_enable "no"
cgi_dns_enable "no"
cgi_suffix_enable "no"
cgi_user "nobody"
log_type "elf"
log_prefix "/var/http/logs/http"
log_max_files 7
log_cycle_time 1440
log_max_file_size 1048576
ssi_enable "no"
ssi_exec "no"
ssi_xbithack "off"
mime_add "application/x-csh" csh
mime_add "application/xsh" sh
}
url //widgets {
doc_root "/var/http/widgets/public"
user_doc_enable "yes"
user_doc_root "public_html"
cgi_enable "yes"
cgi_dns_enable "yes"
cgi_suffix_enable "yes"
cgi_user "nobody"
log_type "clf"
log_prefix "/var/http/logs/widgets"
log_max_files 7
log_cycle_time 1440
log_max_file_size 1048576
ssi_enable "yes"
ssi_exec "yes"
ssi_xbithack "full"
map /cgi-bin/ /var/http/widgets/cgi-bin/ cgi
map /sws-icons/ /var/http/widgets/sws-icons/
}
port 80 {
keepalive_enable "yes"
request_timeout 180
}
port 1880 {
ip_address 129.128.127.126
keepalive_enable "yes"
request_timeout 180
hosts_supported widgets
}
|
新しいサーバーを作成します (Sun WebServer 1.0 の値とともに新しいサーバーに対して作成された構成ファイルを変更します)。
# htserver add "server1" |
Web サイト (ウィジェット) を追加します。
# hthost add -i server1 -h widgets -s /var/http/server1/websites/widgets |
サーバーレベルのファイル/etc/http/server1.httpd.conf を変更します。
server {
server_root "/var/http/server1/"
server_user "root"
mime_file "/etc/http/mime.types"
mime_default_type text/html
access_enable "yes"
cache_enable "yes"
cache_small_file_cache_size 8
cache_large_file_cache_size 256
cache_max_file_size 1
cache_verification_time 10
}
url {
site_path /var/http/server1/websites/default_site
site_config "conf/default_site.site.conf"
site_enable "yes"
}
url //widgets {
site_enable "yes"
site_path "/var/http/server1/websites/widgets"
site_config "conf/widgets.site.conf"
conn_end_points 129.128.127.126:1880 :80
}
port 80 {
ip_address 0.0.0.0
keepalive_enable "yes"
request_timeout 180
}
port 1880 {
ip_address 129.128.127.126
keepalive_enable "yes"
request_timeout 180
}
|
/etc/http/mime.types を変更します。
application/java class audio/basic au snd |
/var/http/server1/websites/default_site/conf/default_site.site.conf を変更します。
url {
doc_root /var/http/demo/public
map_file conf/map.conf
realm_file conf/realms.conf
access_file conf/access.conf
content_file conf/content.conf
mime_file conf/mime.types
user_doc_enable "no"
user_doc_root "public_html"
cgi_enable "no"
cgi_dns_enable "no"
cgi_suffix_enable "no"
cgi_user "nobody"
log_type "elf"
log_prefix "/var/http/server1/logs/default"
log_max_files 7
log_cycle_time 1440
log_max_file_size 1048576
ssi_enable "no"
ssi_exec "no"
ssi_xbithack "off"
}
|
/var/http/server1/websites/default_site/conf/mime.types を作成します。
application/x-csh csh application/x-sh sh |
/var/http/server1/websites/default_site/conf/map.conf を変更します。
map /cgi-bin/ /var/http/demo/cgi-bin/ cgi map /sws-icons/ /var/http/demo/sws-icons/ |
/var/http/server1/websites/widgets/conf/widgets.site.conf を変更します。
url {
doc_root /var/http/widgets/public
map_file conf/map.conf
realm_file conf/realms.conf
access_file conf/access.conf
content_file conf/content.conf
mime_file conf/mime.types
user_doc_enable "yes"
cgi_enable "yes"
cgi_dns_enable "yes"
cgi_suffix_enable "yes"
cgi_user "nobody"
log_type "clf"
log_prefix "/var/http/server1/logs/widgets"
log_max_files 7
log_cycle_time 1440
log_max_file_size 1048576
ssi_enable "yes"
ssi_exec "yes"
ssi_xbithack "full"
}
|
/var/http/server1/websites/widgets/conf/map.conf を変更します。
map /cgi-bin/ /var/http/widgets/cgi-bin/ cgi map /sws-icons/ /var/http/widgets/sws-icons/ |
以下に示す Sun WebServer 1.0 の /etc/http/access.acl ファイルおよび委託されたファイル /var/http/widgets/widgets.acl が存在すると仮定します。
/etc/http/access.acl:
url "/sws-administration" {
authentication_type md5
realm serverAdmin
password_file /etc/http/swsadmin.pw
+ user *
}
url "/statistics" {
authentication_type basic
realm statsRealm
password_file /var/http/demo/stats/usrs
group_file /var/http/demo/stats/grps
+ user *
}
url "//widgets" {
delegate /var/http/widgets/widgets.acl
}
|
/var/http/widgets/widgets.acl:
url "/" {
authentication_type basic
realm widgetsRealm
password_file /var/http/widgets/users
group_file /var/http/widgets/groups
+ user *
- user Joe
- group thoseDenied
}
|
グローバル serverAdmin realm (/etc/http/realms/ に存在する) を作成し、ユーザーファイルを /etc/http/swsadmin.pw に置き換えます。
この realm がすでに存在する場合は、コピーコマンドのみを実行してください。
# htrealm add -r serverAdmin -s HTPASSWD # cp /etc/http/swsadmin.pw /etc/http/realms/serverAdmin/users |
グローバル statsRealm を作成し、ユーザーファイルおよびグループファイルを上記「/statistics」URL で指定されているファイルに置き換えます。この新しい realm をデフォルトサイトおよびウィジェットサイトの realms.conf ファイルに追加します。
以下の <hostname> は、ワークステーションのホスト名 (デフォルトサイトの指定に使われる) を意味します。
# htrealm add -r statsRealm -s HTPASSWD # cp /var/http/demo/stats/usrs /etc/http/realms/statsRealm/users # cp /var/http/demo/stats/grps /etc/http/realms/statsRealm/groups # htrealm add -i server1 -h widgets -r statsRealm -s HTPASSWD ¥ -d /etc/http/realms/statsRealm # htrealm add -i server1 -h <hostname> -r statsRealm -s HTPASSWD -d ¥ -d /etc/http/realms/statsRealm |
ローカル widgetsRealm をウィジェットサイトで作成し、ユーザーファイルとグループファイルを上記で指定されたファイルに置き換えます。
# htrealm add -i server1 -h widgets -r widgetsRealm -s HTPASSWD # cp /var/http/widgets/users ¥ var/http/server1/websites/widgets/conf/realms/widgetsRealm/ # cp /var/http/widgets/groups ¥ /var/http/server1/websites/widgets/conf/realms/widgetsRealm/ |
/etc/http/access.conf を変更します。
url /sws-administration {
authentication_type md5
realm serverAdmin
+ user *
}
|
/var/http/server1/websites/default_site/conf/access.conf を変更します。
# Specify /sws-administration ACL here for site administration,
# create a siteAdmin realm and add administrators to that realm
# url "/sws-administration" {
# authentication_type md5
# realm siteAdmin
# + user *
# }
url "/statistics" {
authentication_type basic
realm statsRealm
+ user *
}
|
/var/http/server1/websites/widgets/conf/access.conf を変更します。
# Specify /sws-administration ACL here for site administration
url "/statistics" {
authentication_type basic
realm statsRealm
+ user *
}
url "/" {
authentication_type basic
realm widgetsRealm
+ user *
- user Joe
- group thoseDenied
}
|