Apache の設定

公開までの道のり

HP用ユーザ("webmaster")の追加・設定

まず、sshでリモート操作を可能にするため
  1. サーバにHP公開用ディレクトリを掘る
    -- trisalに -- 
    $ cd /
    $ sudo mkdir export
    $ sudo cd export && mkdir home1
    $ sudo mkdir home1/webmaster
    
  2. sshログイン用にユーザ登録をする
    -- trisalに --
    $ sudo groupadd export
    $ sudo useradd -g export -d /export/home1/ webmaster
    	
    	※useradd -g [グループ名] -d [HOMEディレクトリまでのパス]
    	  -s [シェル] [追加するユーザー名]
    	
    $ sudo passwd webmaster
    
  3. HP用アカウントをssh経由でログインしてみるテスト
    -- s30@debian --
    $ssh webmaster@hjk.homedns.org
    	
    	webmaster@hjk.homedns.org' password:
    	を訊かれる。入れたみたい。
    	
    
  4. このままだと /export/home1/ 以下は root にのっとられているので、 オーナー(所有者)を webmaster オーナーグループを export に変えてやる。
    --- trisal ---
    $ sudo chown -R webmaster /export/home1
    	
    	file1の所有者を変更する
    	# chown hoge-user file1 ←fileの所有者をhoge-userに変更する
    	# chown -R www public_html
    	  public_htmlディレクトリ内のすべてのファイル及びディレクトリ
    	  の所有者をwwwにする
    	  # chown -R www public_html
    	  public_htmlディレクトリ内すべてのファイルおよびディレクトリの
    	  グループをwwwにする
    	# chown hoge-user:ftp-user ftp_file
    	  ftp_fileの所有者をhoge-userにし,グループをftp-userに変更する
    
  5. 改めて webmaster@hjk.homedns.org でログイン後、ls -l で所有者が かわっていることを確認。
  6. Apache2 の /usr/local/apache2/conf/httpd.conf の編集
    
    --- trisal ---
    
    --- L.267 あたり ---
    #User nobody
    #Group #-1
    User apache
    Group www
    
    --- L.291 あたり ---
    ServerName hjk.homedns.org:80
    
    -- L307 あたり ---
    #2004-2-29 ドキュメントルートの変更 
    #DocumentRoot "/usr/local/apache2/htdocs"
    DocumentRoot "/export/home1"
    
    --- L.334 あたり ---
    #2004-2-29 ディレクトリ変更 www.jpring.net/jitaku/apache-user.html
    #Directory "/usr/local/apache2/htdocs">
    Directory "/export/home1">
    
    --- L.350 あたり ---
    #修正2004-02-29 ユーザーディレクトリーにCGIを設置して
    動作するようにし、index.htmlがない場合にインデックスリストを
    表示しないようにする。
    #    Options Indexes FollowSymLinks
         Options Follow@SymLinks Includes ExecCGI MultiViews
    	--- L.373 あたり ---
    #修正 2004-02-29 ユーザディレクトリの変更 
    #UserDir public_html
    UserDir /home/*/public_html
    
    --- L.380 あたり ---
    
    #あたりをすべてコピーして赤の部分を書き換える
    #Directory /export/home1/*/public_html> 380
    #    AllowOverride FileInfo AuthConfig Limit Indexes
    
    #    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    
    #    Limit GET POST OPTIONS PROPFIND>
    #        Order allow,deny
    #        Allow from all
    #    /Limit>
    #    LimitExcept GET POST OPTIONS PROPFIND>
    #        Order deny,allow
    #        Deny from all
    #    /LimitExcept>
    #Directory>
    Directory /export/home1/*/public_html>
        AllowOverride FileInfo AuthConfig Limit Indexes
    	    Options MultiViews SymLinksIfOwnerMatch ExecCGI IncludesNoExec
        Limit GET POST OPTIONS PROPFIND>
            Order allow,deny
            Allow from all
        /Limit>
        LimitExcept GET POST OPTIONS PROPFIND>
            Order deny,allow
            Deny from all
        /LimitExcept>
    /Directory>
    
    --- L.402 あたり ---
    #修正 2004-02-29 index.pho追加
    #DirectoryIndex index.html index.html.var
    DirectoryIndex index.html index.php index.htm index.html.var
    
    --- L.447 あたり ---
    ##*.bz2 や *.lzh のようなバイナリファイルなのにブラウザに表示されてしまうことを防ぐために 
    ##DefaultType text/plain
    DefaultType application/octet-stream
    
    --- L.523 あたり ---
    ##一つ前のページの URL と,ブラウザの銘柄がログに入る。 どのページからリンクをたどって来たか,どんなブラウザを使っているかがわかる。
    ##CustomLog logs/access_log common
    
    
    --- L.778 あたり ---
    #修正 2004-02-29 日本語文字化け対策 1
    #LanguagePriority en ca cs da de el eo es et fr he hr it ja … 
    LanguagePriority ja en ca cs da de el eo es et fr he hr it ko …
    
    --- L.799 あたり ---
    #修正 2004-02-29 日本語文字化け対策 2 (コメントアウト)
    #AddDefaultCharset ISO-8859-1 
    
  7. テスト後、Apache2 起動
    --- trisal ---
    $ sudo /usr/loacl/apache2/bin/apachctrl configtest
    $ Syntax ok
    $ sudo /usr/local/apache2/bin/apachctrl start
    
  8. s30@debian の ~/works/hp/webmaster 内のファイルすべて、 trisal の /export/home1/webmaster/public_html へ転送する。
    多数のディレクトリを含むため、sftp より scp -r を使う。
    確認:s30@debian -> trisal の際の pwd は "/export/home1"。 現在のところ、"/export/home1/webmaster" は掘ってある。
    	--- s30@debian ---
    	$ cd ~/works/hp/webmaster
    	$ ls -F
    	$ public_html/
    	$ scp -r public_thml webmaster@hjk.homedns.org:webmaster
    	(転送開始)
    	webmaster@webmaster $ pwd
    	webmaster@webmaster $ /export/home1
    	webmaster@webmaster $ cd webmaster
    	webmaster@webmaster $ ls
    	webmaster@webmaster $ public_html
    	
    作っていなかった public_html が trisal に自動的に作成されていることがわかる。 scp -r が成功していることが分かる。
  9. ブラウザより hjk.homedns.org/~webmaster/index.htmlで確認して、終了。