DAY1 : 必要最小限の設定

Linux Basic/Master で行った内容の復習となります。
設定ファイルは /etc/httpd/conf/httpd.conf です。

BASIC認証 抜粋

  1. ディレクトリ作成
    /var/www/html/staff を作成し、その中に .htpasswd と index.html ファイルを作成します。
    # mkdir /var/www/html/staff
    # cd /var/www/html/staff
    # htpasswd -c .htpasswd staff
    New password: *****
    Re-type new password:  *****
    Adding password for user staff
    [root@h030 staff]# ls -l .htpasswd
    -rw-r--r-- 1 root root 20 12月 26 14:26 .htpasswd
    [root@h030 staff]# cat index.html
    <!-- vi などを使い新規作成する -->
    <html>
    <head>
    <title>Staff top</title>
    </haed>
    <body>
    <h1>Welcome staff area</h1>
    </body>
    </html>
    

  2. 設定の追加(抜粋)
    # <directory>ディレクティブ群の最後追加
    ## ycos 2010/12/19 ++++
    <Directory "/var/www/html/staff">
            AuthType        Basic
            AuthName        "Staff only"
            AuthUserFile    /var/www/html/staff/.htpasswd
            Require user staff
    <Directory>
    ## ycos 2010/12/19 ----

CGI の追加

今回は http://www.XXXXXX.la.net/cgi-bin/ 下への配置であるため、特にサーバ設定の変更はない。
/var/www/cgi-bin/showenv.cgi
#! /bin/bash
cat <<EOD
Content-type: text/plain

`env`
EOD

ユーザディレクトリ(抜粋)

/etc/httpd/conf.d/userdir.conf 内の設定を修正する。
#
<IfModule mod_userdir.c>
    #
    # UserDir is disabled by default since it can confirm the presence
    # of a username on the system (depending on home directory
    # permissions).
    #
# このエントリをコメントアウト
#    UserDir disable

    #
    # To enable requests to /~user/ to serve the user's public_html
    # directory, remove the "UserDir disable" line above, and uncomment
    # the following line instead:
    # 
# ここを有効化
     UserDir public_html
</IfModule>
なお、ユーザディレクトリは (~/public_html) ユーザ Apache から参照できるパーミッションに変更する必要がある。
$ ls -ld ~
drwx--x--x 23 student student 1024 12月 26 14:25 /home/student
$ ls -ld ~/public_html/
drwxrwxr-x 2 student student 1024 12月 19 16:26 /home/student/public_html/