インストール †
# apt-get install apache2
設定ファイルの編集 †
# vi /etc/apache2/conf/httpd.conf
サーバー名の設定
ServerName kayanomori.net:80
html等の公開するファイルを置く場所
#DocumentRoot "/var/www/html"
DocumentRoot "/home/httpd/html"
上にあわせて修正
#<Directory "/var/www/html">
<Directory "/home/httpd/html">
Directoryに適当するオプション
# Options Indexes FollowSymLinks
Options MultiViews SymLinksIfOwnerMatch Includes
http://〜/でアクセスしてきたときに自動的に表示するファイル
#DirectoryIndex index.html index.html.var
DirectoryIndex index.html index.shtml index.php
IPアドレスの逆引きを行う
#HostnameLookups Off
HostnameLookups On
条件によりログファイルを分離させる設定
SetEnvIf Remote_Addr 192.168.0. homelog nolog
SetEnvIf Remote_Addr 127.0.0.1 homelog nolog
SetEnvIf Remote_Host "(asianetcom.net)|(become.com)|(msn)|(bloglines)|(inktomi)|(goo)|(livebot)|(yahoo.net)|(ask.com)" robotlog nolog
SetEnvIf Remote_Addr 60.28.17. robotlog nolog
SetEnvIf Remote_Addr 61.247.197. robotlog nolog
SetEnvIf Remote_Addr 61.247.196. robotlog nolog
SetEnvIf Remote_Addr 219.166.144.19 watchlog nolog
home_log=自分の家からのアクセス用
robot_log=サーチエンジンからのアクセス用
watch_log=監視用
CustomLog logs/home_log common env=homelog
CustomLog logs/robot_log common env=robotlog
CustomLog logs/watch_log common env=watchlog
上以外からのアクセスはaccess_logに記録
#CustomLog logs/access_log combined
CustomLog logs/access_log combined env=!nolog
CGIスクリプト格納用のディレクトリ設定
#ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
ScriptAlias /cgi-bin/ "/home/httpd/cgi-bin/"
#<Directory "/home/httpd/cgi-bin">
拡張子.cgiはcgiスクリプトであると認識させる
AddHandler cgi-script .cgi
起動 †
# /etc/init.d/apache2 start
httpdを起動中: [ OK ]
コメント †