IT pass HikiWiki - [Memo2010][ITPASS] tako 構築作業ログ 7 (WWW3) Diff

  • Added parts are displayed like this.
  • Deleted parts are displayed like this.

10/10/19 に apache2の設定を佐伯,藤田で行った.(ロガー: 佐伯)

{{toc_here}}

[((<ITPASSサーバ構築ドキュメント>)) へ戻る]

== 設定ファイルの編集

各種設定ファイルは以下のとおり.

  httpd 用 -> /usr/local/apache2/conf/httpd.conf
  httpd-ssl 用 -> /usr/local/apache2/conf/extra/httpd-ssl.conf

これらを編集した.

変更の要点は以下の通りである.

* httpd.conf
  * Hiki 領域 ~cps/for-steering/hiki に関する設定を,
    同領域の .htaccess により可能にする

* httpd-vhosts.conf
  * cps.scitec.kobe-u.ac.jp 宛の接続を受ける.
    * ドキュメントルートは /home/cps/public_html にする.
    * http://cps.scitec.kobe-u.ac.jp/~gate/
      以下にアクセスされた場合には,
      https://itpass.scitec.kobe-u.ac.jp/~gate に飛ばす.

* httpd-ssl.conf
  * cps.scitec の場合の https 接続を設定しておく
    * 本来は 404 を返すべきなのだが,  とりあえず.

参考として, オリジナルとの diff を載せておく.

=== httpd.conf の diff

$ diff -u original/httpd.conf httpd.conf
--- original/httpd.conf 2010-10-05 15:39:10.000000000 +0900
+++ httpd.conf  2010-10-19 13:12:54.000000000 +0900
@@ -1,4 +1,3 @@
-#
  # This is the main Apache HTTP server configuration file.  It contains the
  # configuration directives that give the server its instructions.
  # See <URL:http://httpd.apache.org/docs/2.2> for detailed information.
@@ -50,6 +49,7 @@
  #
  # Example:
  # LoadModule foo_module modules/mod_foo.so
+# LoadModule rewrite_module modules/mod_rewrite.so
  #

  <IfModule !mpm_netware_module>
@@ -62,8 +62,8 @@
  # It is usually good practice to create a dedicated user and group for
  # running httpd, as with most system services.
  #
-User daemon
-Group daemon
+User www-data
+Group www-data    

  </IfModule>
  </IfModule>
@@ -85,7 +85,7 @@
  # e-mailed.  This address appears on some server-generated pages, such
  # as error documents.  e.g. admin@your-domain.com
  #
-ServerAdmin you@example.com
+ServerAdmin itpadmin@itpass.scitec.kobe-u.ac.jp

  #
  # ServerName gives the name and port that the server uses to identify itself.
@@ -94,15 +94,14 @@
  #
  # If your host doesn't have a registered DNS name, enter its IP address here.
  #
-#ServerName www.example.com:80
+ServerName itpass.scitec.kobe-u.ac.jp:80

  #
  # DocumentRoot: The directory out of which you will serve your
  # documents. By default, all requests are taken from this directory, but
  # symbolic links and aliases may be used to point to other locations.
  #
-DocumentRoot "/usr/local/apache2/htdocs"
-
+DocumentRoot "/home/itpass/public_html"
  #
  # Each directory to which Apache has access can be configured with respect
  # to which services and features are allowed and/or disabled in that
@@ -115,7 +114,7 @@
      Options FollowSymLinks
      AllowOverride None
      Order deny,allow
-    Deny from all
+
  </Directory>

  #
@@ -128,7 +127,7 @@
  #
  # This should be changed to whatever you set DocumentRoot to.
  #
-<Directory "/usr/local/apache2/htdocs">
+<Directory "/home/itpass/public_html">
      #
      # Possible values for the Options directive are "None", "All",
      # or any combination of:
@@ -163,7 +162,8 @@
  # is requested.
  #
  <IfModule dir_module>
-    DirectoryIndex index.html
+    DirectoryIndex index.html index.htm index.htm.en index.html.en index.htm.ja index.html.ja
+
  </IfModule>

  #
@@ -183,7 +183,7 @@
  # logged here.  If you *do* define an error logfile for a <VirtualHost>
  # container, that host's errors will be logged there and not here.
  #
-ErrorLog "logs/error_log"
+ErrorLog "/var/log/httpd-error.log"

  #
  # LogLevel: Control the number of messages logged to the error_log.
@@ -212,13 +212,13 @@
      # define per-<VirtualHost> access logfiles, transactions will be
      # logged therein and *not* in this file.
      #
-    CustomLog "logs/access_log" common
+    #CustomLog "logs/access_log" common

      #
      # If you prefer a logfile with access, agent, and referer information
      # (Combined Logfile Format) you can use the following directive.
      #
-    #CustomLog "logs/access_log" combined
+    CustomLog "/var/log/httpd-access_org" combined
  </IfModule>

  <IfModule alias_module>
@@ -265,10 +265,11 @@
  # CGI directory exists, if you have that configured.
  #
  <Directory "/usr/local/apache2/cgi-bin">
-    AllowOverride None
-    Options None
-    Order allow,deny
-    Allow from all
+    AllowOverride AuthConfig Limit
+    Options ExecCGI FollowSymLinks IncludesNoExec
+
+
+
  </Directory>

  #
@@ -315,7 +316,7 @@
      # To use CGI scripts outside of ScriptAliased directories:
      # (You will also need to add "ExecCGI" to the "Options" directive.)
      #
-    #AddHandler cgi-script .cgi
+    AddHandler cgi-script .cgi .rb

      # For type maps (negotiated resources):
      #AddHandler type-map var
@@ -379,13 +380,13 @@
  #Include conf/extra/httpd-languages.conf

  # User home directories
-#Include conf/extra/httpd-userdir.conf
+Include conf/extra/httpd-userdir.conf

  # Real-time info on requests and configuration
  #Include conf/extra/httpd-info.conf

  # Virtual hosts
-#Include conf/extra/httpd-vhosts.conf
+Include conf/extra/httpd-vhosts.conf

  # Local access to the Apache HTTP Server Manual
  #Include conf/extra/httpd-manual.conf
@@ -397,7 +398,7 @@
  #Include conf/extra/httpd-default.conf

  # Secure (SSL/TLS) connections
-#Include conf/extra/httpd-ssl.conf
+Include conf/extra/httpd-ssl.conf
  #
  # Note: The following must must be present to support
  #       starting without SSL on platforms with no /dev/random equivalent
@@ -407,3 +408,57 @@
  SSLRandomSeed startup builtin
  SSLRandomSeed connect builtin
  </IfModule>
+
+#
+# Setting for Hiki Area
+#
+<Directory "/home/epalab/public_html/hiki">
+ AllowOverride ALL
+ Options -MultiViews
+</Directory>
+
+<Directory "/home/itpass/public_html/hiki">
+ AllowOverride ALL
+ Options -MultiViews
+</Directory>
+
+<Directory "/home/itpass/public_html/hiki-secret">
+ AllowOverride ALL
+ Options -MultiViews
+</Directory>
+
+<Directory "/home/cps/public_html/for-steering/hiki-wheel">
+ AllowOverride ALL
+ Options -MultiViews
+</Directory>
+
+
+<Directory "/home/tansaku/public_html/hiki">
+ AllowOverride ALL
+ Options -MultiViews
+</Directory>
+
+<Directory "/home/uwabami/public_html/hiki">
+ AllowOverride FileInfo AuthConfig Limit Indexes Options=ExecCGI,FollowSymlinks
+ Options -MultiViews
+</Directory>
+
+<Directory "/home/gpgpu/public_html/hiki">
+ AllowOverride FileInfo AuthConfig Limit Indexes Options=ExecCGI,FollowSymlinks
+ Options -MultiViews
+</Directory>
+
+<Directory "/home/gridcomp/public_html/hiki">
+ AllowOverride FileInfo AuthConfig Limit Indexes Options=ExecCGI,FollowSymlinks
+ Options -MultiViews
+</Directory>
+
+<Directory "/home/ayako/public_html/suzuhiki">
+ AllowOverride FileInfo AuthConfig Limit Indexes Options=ExecCGI,FollowSymlinks
+ Options -MultiViews
+</Directory>
+
+<Directory "/home/pschool/public_html/hiki">
+ AllowOverride FileInfo AuthConfig Limit Indexes Options=ExecCGI,FollowSymlinks
+ Options -MultiViews
+</Directory>

=== extra/httpd-ssl.conf の diff

$ diff -u original/extra/httpd-ssl.conf extra/httpd-ssl.conf
--- original/extra/httpd-ssl.conf       2010-10-05 15:39:11.000000000 +0900
+++ extra/httpd-ssl.conf        2010-10-19 13:27:48.000000000 +0900
@@ -71,14 +71,15 @@
  ## SSL Virtual Host Context
  ##

-<VirtualHost _default_:443>
+NameVirtualHost *:443
+<VirtualHost *:443>

  #   General setup for the virtual host
-DocumentRoot "/usr/local/apache2/htdocs"
-ServerName www.example.com:443
-ServerAdmin you@example.com
-ErrorLog "/usr/local/apache2/logs/error_log"
-TransferLog "/usr/local/apache2/logs/access_log"
+DocumentRoot "/home/itpass/public_html"
+ServerName itpass.scitec.kobe-u.ac.jp:443
+ServerAdmin itpadmin@itpass.scitec.kobe-u.ac.jp
+ErrorLog "/var/log/httpd-ssl-error.log"
+TransferLog "/var/log/httpd-ssl-access.log"

  #   SSL Engine Switch:
  #   Enable/Disable SSL for this virtual host.
@@ -96,7 +97,7 @@
  #   in mind that if you have both an RSA and a DSA certificate you
  #   can configure both in parallel (to also allow the use of DSA
  #   ciphers, etc.)
-SSLCertificateFile "/usr/local/apache2/conf/server.crt"
+SSLCertificateFile "/usr/local/apache2/conf/ca/itpass/server.crt"
  #SSLCertificateFile "/usr/local/apache2/conf/server-dsa.crt"

  #   Server Private Key:
@@ -104,7 +105,7 @@
  #   directive to point at the key file.  Keep in mind that if
  #   you've both a RSA and a DSA private key you can configure
  #   both in parallel (to also allow the use of DSA ciphers, etc.)
-SSLCertificateKeyFile "/usr/local/apache2/conf/server.key"
+SSLCertificateKeyFile "/usr/local/apache2/conf/ca/itpass/server.key"
  #SSLCertificateKeyFile "/usr/local/apache2/conf/server-dsa.key"

  #   Server Certificate Chain:
@@ -114,7 +115,7 @@
  #   the referenced file can be the same as SSLCertificateFile
  #   when the CA certificates are directly appended to the server
  #   certificate for convinience.
-#SSLCertificateChainFile "/usr/local/apache2/conf/server-ca.crt"
+#SSLCertificateChainFile "/usr/local/apache2/conf/server.crt"

  #   Certificate Authority (CA):
  #   Set the CA certificate verification path where to find CA
@@ -228,4 +229,41 @@
  CustomLog "/usr/local/apache2/logs/ssl_request_log" \
            "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

+</VirtualHost>
+
+<VirtualHost *:443>
+ DocumentRoot "/home/aoelab/public_html"
+ ServerName aoe.scitec.kobe-u.ac.jp:443
+ ServerAdmin itpadmin@itpass.scitec.kobe-u.ac.jp
+ ErrorLog /var/log/httpd-ssl-error.log
+ TransferLog /var/log/httpd-ssl-access.log
+ SSLEngine on
+ SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
+ SSLCertificateFile "/usr/local/apache2/conf/ca/aoe/server.crt"
+ SSLCertificateKeyFile "/usr/local/apache2/conf/ca/aoe/server.key"
+</VirtualHost>
+
+<VirtualHost *:443>
+ DocumentRoot "/home/cps/public_html"
+ ServerName cps.scitec.kobe-u.ac.jp:443
+ ServerAdmin itpadmin@itpass.scitec.kobe-u.ac.jp
+ ErrorLog /var/log/httpd-ssl-error.log
+ TransferLog /var/log/httpd-ssl-access.log
+ SSLEngine on
+ SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
+ SSLCertificateFile "/usr/local/apache2/conf/ca/aoe/server.crt"
+ SSLCertificateKeyFile "/usr/local/apache2/conf/ca/aoe/server.key"
+</VirtualHost>
+
+
+<VirtualHost *:443>
+ DocumentRoot "/home/epalab/public_html"
+ ServerName epa.scitec.kobe-u.ac.jp:443
+ ServerAdmin itpadmin@itpass.scitec.kobe-u.ac.jp
+ ErrorLog /var/log/httpd-ssl-error.log
+ TransferLog /var/log/httpd-ssl-access.log
+ SSLEngine on
+ SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
+ SSLCertificateFile "/usr/local/apache2/conf/ca/epa/server.crt"
+ SSLCertificateKeyFile "/usr/local/apache2/conf/ca/epa/server.key"
  </VirtualHost>

=== extra/httpd-vhosts.conf の diff

diff -u original/extra/httpd-vhosts.conf extra/httpd-vhosts.conf
--- original/extra/httpd-vhosts.conf    2010-10-05 15:39:11.000000000 +0900
+++ extra/httpd-vhosts.conf     2010-10-19 13:25:30.000000000 +0900
@@ -25,21 +25,87 @@
  # match a ServerName or ServerAlias in any <VirtualHost> block.
  #
  <VirtualHost *:80>
-    ServerAdmin webmaster@dummy-host.example.com
-    DocumentRoot "/usr/local/apache2/docs/dummy-host.example.com"
-    ServerName dummy-host.example.com
-    ServerAlias www.dummy-host.example.com
-    ErrorLog "logs/dummy-host.example.com-error_log"
-    CustomLog "logs/dummy-host.example.com-access_log" common
+    ServerAdmin itpadmin@itpass.scitec.kobe-u.ac.jp
+    DocumentRoot "/home/itpass/public_html"
+    ServerName itpass.scitec.kobe-u.ac.jp
+    ErrorLog "/var/log/httpd-error.log"
+    CustomLog "/var/log/httpd-access.log" combined
+
+   <IfModule mod_rewrite.c>
+      RewriteEngine On
+      RewriteLog "/var/log/httpd-rewrite.log"
+      RewriteLogLevel 0
+      RewriteCond %{SERVER_PORT} !^443$
+      RewriteRule ^/hiki/(.*)?$ https://itpass.scitec.kobe-u.ac.jp/hiki/$1 [L,R]
+      RewriteRule ^/hiki/(.*)?$ https://itpass.scitec.kobe-u.ac.jp/hiki-secret/$1 [L,R]
+      # ---- hiki
+      RewriteRule ^/~epalab/hiki/(.*)?$ https://itpass.scitec.kobe-u.ac.jp/~epalab/hiki/$1 [L,R,NE]
+      RewriteRule ^/~itpass/hiki/(.*)?$ https://itpass.scitec.kobe-u.ac.jp/~itpass/hiki/$1 [L,R,NE]
+      RewriteRule ^/~itpass/hiki-secret/(.*)?$ https://itpass.scitec.kobe-u.ac.jp/~itpass/hiki-secret/$1 [L,R,NE]
+      # ---- gate
+      RewriteRule ^/~gate/(.*)?$ https://itpass.scitec.kobe-u.ac.jp/~gate/$1 [L,R,NE]
+      RewriteRule ^/cgi-bin/(.*)?$ https://itpass.scitec.kobe-u.ac.jp/cgi-bin/$1 [L,R,NE]
+    </IfModule>
+</VirtualHost>
+
+# ---- aoelab ----
+<VirtualHost *:80>
+    ServerAdmin itpadmin@itpass.scitec.kobe-u.ac.jp
+    DocumentRoot "/home/aoelab/public_html"
+    ServerName aoe.scitec.kobe-u.ac.jp
+    ErrorLog "/var/log/httpd-error.log"
+    CustomLog "/var/log/httpd-access.log" combined
+    <IfModule mod_rewrite.c>
+      RewriteEngine On
+      RewriteLog "/var/log/httpd-rewrite.log"
+      RewriteLogLevel 0
+      RewriteCond %{SERVER_PORT} !^443$
+      # ---- hiki
+      RewriteRule ^/hiki/(.*)?$ https://itpass.scitec.kobe-u.ac.jp/hiki/$1 [L,R]
+      # ---- gate
+      RewriteRule ^/~gate/(.*)?$ https://itpass.scitec.kobe-u.ac.jp/~gate/$1 [L,R,NE]
+      RewriteRule ^/cgi-bin/(.*)?$ https://itpass.scitec.kobe-u.ac.jp/cgi-bin/$1 [L,R,NE]
+    </IfModule>
  </VirtualHost>

+# ---- cps ----
  <VirtualHost *:80>
-    ServerAdmin webmaster@dummy-host2.example.com
-    DocumentRoot "/usr/local/apache2/docs/dummy-host2.example.com"
-    ServerName dummy-host2.example.com
-    ErrorLog "logs/dummy-host2.example.com-error_log"
-    CustomLog "logs/dummy-host2.example.com-access_log" common
+    ServerAdmin  itpadmin@itpass.scitec.kobe-u.ac.jp
+    DocumentRoot "/home/cps/public_html"
+    ServerName   cps.scitec.kobe-u.ac.jp
+    ErrorLog     "/var/log/httpd-error.log"
+    CustomLog    "/var/log/httpd-access.log" combined
+    <IfModule mod_rewrite.c>
+      RewriteEngine On
+      RewriteLog "/var/log/httpd-rewrite.log"
+      RewriteLogLevel 0
+      RewriteCond %{SERVER_PORT} !^443$
+      # ---- hiki
+      RewriteRule ^/hiki/(.*)?$ https://itpass.scitec.kobe-u.ac.jp/hiki/$1 [L,R]
+      # ---- gate
+      RewriteRule ^/~gate/(.*)?$ https://itpass.scitec.kobe-u.ac.jp/~gate/$1 [L,R,NE]
+      RewriteRule ^/cgi-bin/(.*)?$ https://itpass.scitec.kobe-u.ac.jp/cgi-bin/$1 [L,R,NE]
+    </IfModule>
  </VirtualHost>


+# ---- epalab ----
+<VirtualHost *:80>
+    ServerAdmin itpadmin@itpass.scitec.kobe-u.ac.jp
+    DocumentRoot "/home/epalab/public_html"
+    ServerName epa.scitec.kobe-u.ac.jp
+    ErrorLog /var/log/httpd-error.log
+    CustomLog /var/log/httpd-access.log combined
+    <IfModule mod_rewrite.c>
+      RewriteEngine On
+      RewriteLog "/var/log/httpd-rewrite.log"
+      RewriteLogLevel 0
+      RewriteCond %{SERVER_PORT} !^443$
+      # ---- hiki
+      RewriteRule ^/hiki/(.*)?$ https://epa.scitec.kobe-u.ac.jp/hiki/$1 [L,R]
+      # ---- gate
+      RewriteRule ^/~gate/(.*)?$ https://itpass.scitec.kobe-u.ac.jp/~gate/$1 [L,R,NE]
+      RewriteRule ^/cgi-bin/(.*)?$ https://itpass.scitec.kobe-u.ac.jp/cgi-bin/$1 [L,R,NE]
+    </IfModule>
+</VirtualHost>

== 動作チェック

以下のコマンドで apache を起動した.

  # /usr/local/apache2/bin/apachectl -k start

すると
"Warning: DocumentRoot [/home/cps/public_html] does not exist"
というエラーメッセージが出た.
cps ディレクトリ内に public_html ディレクトリを作成し, 再度上記のコマンドで apache を起動すると, エラーメッセージは出なくなった. 次に,

  $ ps aux

を実行すると, 画面左端に www-data 表示されていたため, 起動しているという
ことがわかった.

apache の設定ファイルに記述されているエラーログの記録場所に存在するログ
ファイルなどを見て, エラーが出ていないことを確認した.

以下のようにして apache を停止させた.

  # /usr/local/apache2/bin/apachectl -k graceful-stop