内容へ移動
heavyhandの実験室
ユーザ用ツール
ログイン
サイト用ツール
検索
ツール
文書の表示
以前のリビジョン
バックリンク
最近の変更
メディアマネージャー
サイトマップ
ログイン
>
最近の変更
メディアマネージャー
サイトマップ
トレース:
•
コマンド
howto:linux:apach2でdocumentrootを変更
この文書は読取専用です。文書のソースを閲覧することは可能ですが、変更はできません。もし変更したい場合は管理者に連絡してください。
====== apache2でDocumentRootを変更 ====== ===== はじめに ===== * デフォルトの DocumentRoot は "/var/www/html" になっており、root での利用となる。別のユーザーでホームページを運用できるよう、専用のユーザー webuser を作成し、/home/webuser/ に環境を構築する。 ===== ユーザー webuser の登録 ===== ==== ユーザー webuserを登録 ==== <code bash> root$>useradd webuser passwd webusr Retype new UNIX password:<パスワードを入力> passwd:<パスワードを入力> all authentication tokens updated successfully. </code> ==== ユーザー webuser のホームディレクトリを確認 ==== <code bash> root$>su - webuser webuser$>pwd /home/webuser webuser$>exit </code> ===== /home/webuser にディレクトリを作成 ===== ==== ディレクトリ構成 ==== <code text> /home/webuser/ └ www ├ cgi-bin ├ error ├ html └ icons </code> ==== ディレクトリ作成 ==== === webuserでログイン後 === <code bash> webuser$>pwd /home/webuser webuser$>mkdir www webuser$>mkdir www/cgi-bin webuser$>mkdir www/error webuser$>mkdir www/html webuser$>mkdir www/icons </code> ===== /etc/httpd/conf/httpd.conf の修正 ===== ==== 以下の設定を変更 ==== === DocumentRootの変更 === <code> DocumentRoot "/var/webuser/www/html" ↓ "/home/webuser/www/html" </code> <code> <Directory "/var/www/html"> ↓ "/home/webusr/www/html"> </code> === icons パスの変更 === <code text> Alias /icons/ "/var/www/icons/" ↓ "/home/webuesr/www/icons/" </code> <code text> <Directory "/var/www/icons"> ↓ "/home/webuser/www/icons"> </code> === cgi-bin パスの変更 === <code text> ScriptAlias /cgi-bin/ "/var/www/cgi-bin/" ↓ "/home/webuesr/www/cgi-bin/" </code> <code text> <Directory "/var/www/cgi-bin"> ↓ "/home/webuser/cgi-bin"> </code> === error パスの変更 === <code text> Alias /error/ "/var/www/error/" ↓ "/home/webuser/www/error/" </code> <code text> <Directory "/var/www/error"> ↓ "/home/webusr/www/error"> </code> ===== seLinuxの設定 ===== ==== DocumentRoot 環境にラベルを設定 ==== <code bash> root$>chcon system_u:object_r:httpd_sys_content_t /home/webusr/www -R root$>chcon system_u:object_r:httpd_sys_script_exec_t /home/webusr/www/cgi-bin -R </code> ===== apache の再起動 ==== ==== httpd.conf の設定を反映させるため再起動 ==== <code bash> root$>/etc/rc.d/init.d/httpd restart httpd を停止中: [ OK ] httpd を起動中: [ OK ] </code>
howto/linux/apach2でdocumentrootを変更.txt
· 最終更新: 2015/12/01 23:54 by
dokuroot
ページ用ツール
文書の表示
以前のリビジョン
バックリンク
文書の先頭へ