はじめての自宅サーバ構築 - Fedora/CentOS - Last Update 2008/07/25
It opened to 2004/09/19.
当サイトはFedora9で運用しています
Visitors
Pageviews
Today(IP/PV)
3,374,115
12,762,048
1,273/8,670

■ TIPS集『Webサーバ(Apache)』

 DocumentRootの他にパスを公開するには?

apacheのデフォルトのドキュメント場所は「/etc/httpd/conf/httpd.conf」内の「DocumentRoot」で指定します。

このドキュメントルート以外にパスを使用したい場合は「alias」を使うと便利です。

例)新規に「/webfolder/myfavorite」を作成し、このパスを「/favorite」として公開する場合

パスを作成
# mkdir -p /webfolder/myfavorite

パーミッション、オーナー変更
# chmod 755 /webfolder/myfavorite
# chmown apache:apache /webfolder/myfavorite


設定ファイルを作成
# vi /etc/httpd/conf.d/myfavorite.conf
Alias /favorite/ "/webfolder/myfavorite"
<Directory "/webfolder/myfavorite">
  Order deny,allow
  Allow from all
</Directory>

apacheを再起動する
# /etc/rc.d/init.d/httpd restart


これで、「http://サーバアドレス/favorite」でアクセスできる様になります
ページ先頭へ

Copyright(©)2004-2008 First home server construction. All Right Reserved.