Dell Optiplex GXa Solaris 8  x86  6/00

戻る




Apache/2.0.47 (Unix) mod_perl/1.99_09 Perl/v5.8.0 
PHP/4.3.2 DAV/2 mod_ssl/1.1.0 OpenSSL/0.9.7b


※後に現在の最新の、
Apache/2.0.48 (Unix) mod_perl/1.99_10 Perl/v5.8.0 PHP/4.3.3 DAV/2 mod_ssl/2.0.48 OpenSSL/0.9.7c
の記録あり。

	事前に
	autoconf-2.54
	libtool-1.4.2
	の2つをインストールしておく必要がある



ポリシー

 ・簡易的にSSLを使い、一部のページのデータを暗号化させたい。

 ・トラフィックを抑えるため、対応しているブラウザからのアクセスの場合は、テキスト
  ベースのデータは圧縮(mod_deflate)して、クライアント側で解凍させる(1.3.x時代
  のmod_gzip) (相手がISDN以下の場合は特に効果が期待できる)

 ・HTTPヘッダー情報に表示されるApacheとそのバージョン名は架空のものを表示させ、
  ある程度のセキュリティを確保したい。

 ・バーチャルドメインを設定して、2個以上のドメイン名で運用したい。

 ・ などなど。




Domain 例:
	Domain1 = domain1.com
	Server Name = www.domain1.com
	
	バーチャルドメインとして、
	Domain2 = domain2.tv
	Server Name  = domain2.tv & www.domain2.tv
	と
	Domain3 = domain3.net
	Server Name = domain3.net
	と
	Domain4 = domain4.com
	Server Name = domain4.com & www.domain4.com



必要なソフトウェア:

httpd-2.0.47.tar.gz	(07-Jul-2003 Rerease)
http://www.apache.org/dist/httpd/

openssl-0.9.7b.tar.gz  (10-Apl-2003 Rerease)
http://www.openssl.org/source/

mod_perl-1.99_09.tar.gz	(27-Apl-2003 Rerease)
http://perl.apache.org/dist/

php-4.3.2.tar.gz  (29-May-2003 Rerease)
http://jp.php.net/


準備

※ これ以前にPerl-5.8.0-RC2をインストールしておく必要がある

作業ディレクトリを作成し、移動しておく
	$ mkdir /opt/src/apache-2.0.47/
	$ cd /opt/src/apache-2.0.47/



OpenSSL (0.9.7b) のインストール

アーカイブをダウンロードする
	$ wget http://www.openssl.org/source/openssl-0.9.7b.tar.gz

解凍展開する
	$ tar xozf ./openssl-0.9.7b.tar.gz

SuperUserになる
	$ su
	password:

オーナーとグループを変更しておく
	# chown -R root:other openssl-0.9.7b

解凍展開されたディレクトリに移る
	# cd openssl-0.9.7b

最適化する
	# ./config

コンパイルする
	# make

SuperUserになってインストールする
	# make install


シェアード・ライブラリをmakeする
	# make build-shared

出来上がったライブラリをそれぞれ/usr/local/lib内にコピー
	# cp libcrypto.a /usr/local/lib/
	# cp libcrypto.so /usr/local/lib/
	# cp libcrypto.so.0 /usr/local/lib/
	# cp libcrypto.so.0.9.7 /usr/local/lib/
	# cp libssl.a /usr/local/lib/
	# cp libssl.so /usr/local/lib/
	# cp libssl.so.0 /usr/local/lib/
	# cp libssl.so.0.9.7 /usr/local/lib/

コピーしたライブラリのシンボリックリンクを/usr/lib/内に張る
	# ln -s /usr/local/lib/libcrypto.a /usr/lib/
	# ln -s /usr/local/lib/libcrypto.so /usr/lib/
	# ln -s /usr/local/lib/libcrypto.so.0 /usr/lib/
	# ln -s /usr/local/lib/libcrypto.so.0.9.7 /usr/lib/
	# ln -s /usr/local/lib/libssl.a /usr/lib/
	# ln -s /usr/local/lib/libssl.so /usr/lib/
	# ln -s /usr/local/lib/libssl.so.0 /usr/lib/
	# ln -s /usr/local/lib/libssl.so.0.9.7 /usr/lib/

一般ユーザーに戻る
	# exit



Apache/2.0.47のインストール

アーカイブをダウンロードする
	$ wget http://www.apache.org/dist/httpd/httpd-2.0.47.tar.gz

解凍展開する
	$ tar xozf httpd-2.0.47.tar.gz

ディレクトリを移動する
	$ cd /opt/src/apache-2.0.47/httpd-2.0.47

cshやtcshではうまくいかないので、shかbashになる
	$ sh

環境変数を指定しつつ最適化スクリプトを実行する

	$ CC=gcc LDFLAGS=-L/usr/local/lib ./configure --enable-modules=mod_access \
	--enable-modules=mod_actions \
	--enable-modules=mod_alias \
	--enable-modules=mod_asis \
	--enable-modules=mod_auth \
	--enable-modules=mod_auth_anon \
	--enable-modules=mod_auth_db \
	--enable-modules=mod_auth_dbm \
	--enable-modules=mod_auth_digest \
	--enable-modules=enable-cern-meta \
	--enable-cache \
	--enable-disk-cache \
	--enable-mem-cache \
	--enable-file-cache \
	--enable-headers \
	--enable-ssl \
	--enable-dav \
	--enable-info \
	--enable-cgi \
	--enable-cgid \
	--enable-dav-fs \
	--enable-vhost-alias \
	--enable-speling \
	--enable-rewrite \
	--enable-expires \
	--enable-deflate \
	--with-z=/usr/local/lib \
	--with-mpm=prefork \
	--enable-so


簡単な説明: (勝手な解釈なので間違ってるかも)
mod_access IPアドレスとHOST名でアクセス制御をする
mod_actions リクエストに応じたCGI処理をする
mod_alias DocumentRoot内にないディレクトリを、あたかもあるか
のように見せかけるように別途設定可能にする
mod_asis 拡張子に.htmlを使っていないファイルの送信時のHTTP
ヘッダーを省略させる
mod_auth パスワード認証機能(ベーシック認証)を使えるようにする
mod_auth_anon ベーシック認証パスワードをかけたディレクトリで、
匿名アクセスも可能にできる
mod_auth_db BerkrayDBを使ったベーシック認証を可能にする
mod_auth_dbm DBMを使ったベーシック認証を可能にする
mod_auth_digest MD5を使ったダイジェストユーザー認証を可能にする
cern-meta CERNをエミュレートする
file-cache メモリーにキャッシュさせて、応答速度を上げる
cache 一度リクエストされたファイルは、アンコールされる可能性
が高いので、ダイナミックなキャッシュをさせる
disk-cache ディスクキャッシュを使用する
mem-cache メモリーキャッシュを使用する
headers HTTPヘッダーをカスタマイズできる
ssl SSLを使用可能にする
dav WebDAVを使用可能にする
info 設定表示を使用可能にする
cgi CGIを使用可能にする
cgid マルチスレッドでもCGIを使用可能にする
dav-fs DAVファイルシステムを使用可能にする
vhost-alias バーチャルホストを使用可能にする
speling 間違ったリクエストに対し、近いと判断できる
リクエストにリダイレクトさせる
rewrite リダイレクトを使用可能にする
expires クライアントのキャッシュを指定期限が過ぎ
たら、無効にさせることが出来るようにする
deflate 圧縮送信を使用可能にする
with-z=/usr/local/lib 圧縮用のzlibが格納されているライブラリディレクトリ
を指定
with-mpm=prefork mod_perlを使用する時に、これを含める必要がある
so DSOを有効にする
makeする $ make (とっても時間がかかる) SuperUserになってインストールする $ su password: # make install # exit $ mod_perl-1.99_09のインストール 作業ディレクトリに戻る $ cd /opt/src/apache-2.0.47/ mod_perlのアーカイブをダウンロードする $ wget http://perl.apache.org/dist/mod_perl-1.99_09.tar.gz ダウンロードしたアーカイブを解凍展開する $ tar xozf ./mod_perl-1.99_09.tar.gz 展開したディレクトリに移動する cd mod_perl-1.99_09 perlで書かれた最適化スクリプトを走らせる $ /usr/local/bleedperl/bin/perl Makefile.PL MP_AP_PREFIX=/usr/local/apache2 コンパイルする $ make SuperUserになる $ su password: インストールする # make install PHP/4.3.2のインストール 作業ディレクトリを作成する $ mkdir /opt/src/php-4.3.2 作成したディレクトリに移動する $ cd /opt/src/php-4.3.2 アーカイブをダウンロードする $ wget http://jp.php.net/get/php-4.3.2.tar.gz/from/this/mirror 解凍展開する $ tar xozf ./php-4.3.2.tar.gz 展開されたディレクトリに移動する $ cd php-4.3.2 最適化スクリプトを実行する $ ./configure --with-apxs2=/usr/local/apache2/bin/apxs \ --with-mysql=/usr/local/mysql \ --enable-ftp コンパイルする $ make SuperUserになってインストールする $ su password: # # make install 設定ファイルを所定の位置にコピーする。 # cp php.ini-dist /usr/local/lib/php.ini # exit $ セキュリティ を高めるため、HTTPでアクセスされた時の応答メッセージ (httpd名とバージョン)を変える。 もしも自分が使っているバージョンにセキュリティホールが見つかってしまっ た場合、クラッカーはその情報を元に攻撃を仕掛けてくる可能性があるので、 ソースを少々書き換えて、表示させるhttpd名とバージョンを架空のHTTPDにして しまう。 面倒だが、Apacheをもう一度コンパイルし直し、再インストールする。 (PHPのインストール後にこれをしないとPHPのconfigureが途中で「Apacheの2.0以降 でやってくれぃ」というメッセージを残して止まってしまう) Apacheの作業ディレクトリのincludeディレクトリに移動する $ cd /opt/src/apache-2.0.47/httpd-2.0.47/include/ ap_release.hファイルをviで開く $ vi ap_release.h 最下項目(74行目以降)を以下のように書き換えて保存する (" " の中は適当に) /* ### 変更前 ### */ #define AP_SERVER_BASEVENDOR "Apache Software Foundation" #define AP_SERVER_BASEPRODUCT "Apache" #define AP_SERVER_MAJORVERSION "2" #define AP_SERVER_MINORVERSION "0" #define AP_SERVER_PATCHLEVEL "46" #define AP_SERVER_MINORREVISION AP_SERVER_MAJORVERSION "." AP_SERVER_MINORVERSION #define AP_SERVER_BASEREVISION AP_SERVER_MINORREVISION "." AP_SERVER_PATCHLEVEL #define AP_SERVER_BASEVERSION AP_SERVER_BASEPRODUCT "/" AP_SERVER_BASEREVISION #define AP_SERVER_VERSION AP_SERVER_BASEVERSION /* ### 変更後例 ### */ #define AP_SERVER_BASEVENDOR "MicroGates IOS" #define AP_SERVER_BASEPRODUCT "Netskirt-Entersurprise" #define AP_SERVER_MAJORVERSION "3" #define AP_SERVER_MINORVERSION "1" #define AP_SERVER_PATCHLEVEL "55" #define AP_SERVER_MINORREVISION AP_SERVER_MAJORVERSION "." AP_SERVER_MINORVERSION #define AP_SERVER_BASEREVISION AP_SERVER_MINORREVISION "." AP_SERVER_PATCHLEVEL #define AP_SERVER_BASEVERSION AP_SERVER_BASEPRODUCT "/" AP_SERVER_BASEREVISION #define AP_SERVER_VERSION AP_SERVER_BASEVERSION ※前回のconfigureでモジュールを含めた場合は、httpd.confに  「ServerTokens ProductOnly」 を記述することを忘れずに ひとつ上のディレクトリに戻る $ cd ../ 前回のコンパイルを無効にす $ make clean もう一度コンパイルする (やっぱり時間がかかる) $ make SuperUserになって再インストールする $ su password: # # make install # exit $ 証明書発行 Key を生成する時は、ランダムな情報を入力する必要があるが、例えば以下のようにすることで作成 することも可能 # cd /usr/local/ssl/bin # ./openssl md5 * > rand.dat Private Key を作成する # ./openssl genrsa -rand ./rand.dat -des 1024 > /usr/local/ssl/private/key.pem =========================================================== 95 semi-random bytes loaded Generating RSA private key, 1024 bit long modulus .................++++++ ....................++++++ e is 65537 (0x10001) Enter PEM pass phrase: ********** Verifying password - Enter PEM pass phrase: ********** =========================================================== Private Key からパスフレーズを外す # ./openssl rsa -in /usr/local/ssl/private/key.pem -out /usr/local/ssl/private/key2.pem read RSA key Enter PEM pass phrase: ********** writing RSA key 今回は認証局に依頼せず、自分で署名した証明を作成するので、下記のようになる # ./openssl req -new -x509 -key /usr/local/ssl/private/key2.pem -out /usr/local/ssl/certs/cert.pem =========================================================== You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [AU]:JP State or Province Name (full name) [Some-State]:Tokyo Locality Name (eg, city) []:Toshima-ku Organization Name (eg, company) [Internet Widgits Pty Ltd]:domain1 Organizational Unit Name (eg, section) []:tech Common Name (eg, YOUR name) []:www.domain1.com Email Address []:you@domain1.com =========================================================== httpd.confを修正する httpd.confの便利な日本語訳が、大阪のエンジニアスクールの"IT Boost社" に掲載されてます。トップページから、各種ソフトウェアのインストール・設定" →"Apache 2 httpd.conf 日本語訳"を辿ってみてください 念のためデフォルトのhttpd.confのバックアップを取っておく # cp /usr/local/apache2/conf/httpd.conf /usr/local/apache2/conf/httpd.conf.default viでhttpd.confを開く # vi /usr/local/apache2/conf/httpd.conf 以下の"赤字"の部分を書き換えて保存する (注! 以下のhttpd.confの見本は、「とにかく何でも動く」設定で、セキュリティに関しては考慮 していない実際はcgiを許可するディレクトリなどは慎重にセキュリティポリシーを考える) =========================================================== ### Section 1: Global Environment ServerRoot "/usr/local/apache2" <IfModule !mpm_winnt.c> <IfModule !mpm_netware.c> #LockFile logs/accept.lock </IfModule> </IfModule> <IfModule !mpm_netware.c> <IfModule !perchild.c> #ScoreBoardFile logs/apache_runtime_status </IfModule> </IfModule> <IfModule !mpm_netware.c> PidFile /var/log/apache/httpd.pid </IfModule> Timeout 300 KeepAlive On MaxKeepAliveRequests 100 KeepAliveTimeout 15 <IfModule prefork.c> StartServers 5 MinSpareServers 5 MaxSpareServers 10 MaxClients 150 MaxRequestsPerChild 0 </IfModule> <IfModule worker.c> StartServers 2 MaxClients 150 MinSpareThreads 25 MaxSpareThreads 75 ThreadsPerChild 25 MaxRequestsPerChild 0 </IfModule> <IfModule perchild.c> NumServers 5 StartThreads 5 MinSpareThreads 5 MaxSpareThreads 10 MaxThreadsPerChild 20 MaxRequestsPerChild 0 </IfModule> <IfModule mpm_winnt.c> ThreadsPerChild 250 MaxRequestsPerChild 0 </IfModule> <IfModule beos.c> StartThreads 10 MaxClients 50 MaxRequestsPerThread 10000 </IfModule> <IfModule mpm_netware.c> ThreadStackSize 65536 StartThreads 250 MinSpareThreads 25 MaxSpareThreads 250 MaxThreads 1000 MaxRequestsPerChild 0 </IfModule> <IfModule mpmt_os2.c> StartServers 2 MinSpareThreads 5 MaxSpareThreads 10 MaxRequestsPerChild 0 </IfModule> Listen 80 LoadModule perl_module modules/mod_perl.so LoadFile /usr/local/mysql/lib/mysql/libmysqlclient.so LoadModule php4_module modules/libphp4.so ### Section 2: 'Main' server configuration <IfModule !mpm_winnt.c> <IfModule !mpm_netware.c> User nobody Group nobody </IfModule> </IfModule> ServerAdmin you@domain1.com ServerName www.domain1.com:80 UseCanonicalName On DocumentRoot "/export/home/webadmin/htdocs" <Directory /> Options FollowSymLinks AllowOverride AuthConfig Limit </Directory> <Directory "/export/home/webadmin/htdocs"> Options FollowSymLinks MultiViews ExecCGI Includes AddHandler cgi-script .cgi AddHandler server-parsed .html AddType text/html .shtml AddType application/x-httpd-cgi .cgi AddType application/x-httpd-cgi .pl AddType application/x-httpd-php .php AddType application/x-httpd-php .php3 AllowOverride AuthConfig Limit Order allow,deny Allow from all </Directory> UserDir /export/home/*/public_html <Directory /export/home/*/public_html> Options FollowSymLinks MultiViews ExecCGI Includes AddHandler cgi-script .cgi AddHandler server-parsed .shtml AddType text/htmli .shtml AddType application/x-httpd-cgi .cgi AddType application/x-httpd-cgi .pl AllowOverride AuthConfig Limit Order allow,deny Allow from all <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> DirectoryIndex index.html index.htm index.shtml index.cgi index.php index.php3 index.html.var AccessFileName .htaccess <Files ~ "^\.ht"> Order allow,deny Deny from all </Files> TypesConfig conf/mime.types DefaultType text/plain <IfModule mod_mime_magic.c> MIMEMagicFile conf/magic </IfModule> HostnameLookups On ErrorLog /var/log/apache/error_log LogLevel warn LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined LogFormat "%h %l %u %t \"%r\" %>s %b" common LogFormat "%{Referer}i -> %U" referer LogFormat "%{User-agent}i" agent SetEnvIf Request_URI \.gif$ gif-image CustomLog /var/log/apache/access_log "%h %l %u %t \"%r\" %s %b \"%{User-Agent}i\" %{Referer}i\"" env=!gif-image ServerTokens ProductOnly ServerSignature On #Alias /icons/ "/usr/local/apache2/icons/" # #<Directory "/usr/local/apache2/icons"> # Options Indexes MultiViews # AllowOverride None # Order allow,deny # Allow from all #</Directory> #Alias /manual "/usr/local/apache2/manual" #<Directory "/usr/local/apache2/manual"> # Options Indexes FollowSymLinks MultiViews IncludesNoExec # AddOutputFilter Includes html # AllowOverride None # Order allow,deny # Allow from all #</Directory> ScriptAlias /cgi-bin/ "/export/home/webadmin/cgi-bin/" <IfModule mod_cgid.c> </IfModule> <Directory "/export/home/webadmin/cgi-bin"> AllowOverride Limit AuthConfig Options None Order allow,deny Allow from all </Directory> #AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip #AddIconByType (TXT,/icons/text.gif) text/* #AddIconByType (IMG,/icons/image2.gif) image/* #AddIconByType (SND,/icons/sound2.gif) audio/* #AddIconByType (VID,/icons/movie.gif) video/* #AddIcon /icons/binary.gif .bin .exe #AddIcon /icons/binhex.gif .hqx #AddIcon /icons/tar.gif .tar #AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv #AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip #AddIcon /icons/a.gif .ps .ai .eps #AddIcon /icons/layout.gif .html .shtml .htm .pdf #AddIcon /icons/text.gif .txt #AddIcon /icons/c.gif .c #AddIcon /icons/p.gif .pl .py #AddIcon /icons/f.gif .for #AddIcon /icons/dvi.gif .dvi #AddIcon /icons/uuencoded.gif .uu #AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl #AddIcon /icons/tex.gif .tex #AddIcon /icons/bomb.gif core #AddIcon /icons/back.gif .. #AddIcon /icons/hand.right.gif README #AddIcon /icons/folder.gif ^^DIRECTORY^^ #AddIcon /icons/blank.gif ^^BLANKICON^^ #DefaultIcon /icons/unknown.gif #ReadmeName README.html #HeaderName HEADER.html #IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t AddEncoding x-compress Z AddEncoding x-gzip gz tgz AddLanguage da .dk AddLanguage nl .nl AddLanguage en .en AddLanguage et .et AddLanguage fr .fr AddLanguage de .de AddLanguage he .he AddLanguage el .el AddLanguage it .it AddLanguage ja .ja AddLanguage pl .po AddLanguage ko .ko AddLanguage pt .pt AddLanguage nn .nn AddLanguage no .no AddLanguage pt-br .pt-br AddLanguage ltz .ltz AddLanguage ca .ca AddLanguage es .es AddLanguage sv .se AddLanguage cz .cz AddLanguage ru .ru AddLanguage tw .tw AddLanguage zh-tw .tw AddLanguage hr .hr LanguagePriority en da nl et fr de el it ja ko no pl pt pt-br ltz ca es sv tw ForceLanguagePriority Prefer Fallback AddDefaultCharset Off AddCharset ISO-8859-1 .iso8859-1 .latin1 AddCharset ISO-8859-2 .iso8859-2 .latin2 .cen AddCharset ISO-8859-3 .iso8859-3 .latin3 AddCharset ISO-8859-4 .iso8859-4 .latin4 AddCharset ISO-8859-5 .iso8859-5 .latin5 .cyr .iso-ru AddCharset ISO-8859-6 .iso8859-6 .latin6 .arb AddCharset ISO-8859-7 .iso8859-7 .latin7 .grk AddCharset ISO-8859-8 .iso8859-8 .latin8 .heb AddCharset ISO-8859-9 .iso8859-9 .latin9 .trk AddCharset ISO-2022-JP .iso2022-jp .jis AddCharset ISO-2022-KR .iso2022-kr .kis AddCharset ISO-2022-CN .iso2022-cn .cis AddCharset Big5 .Big5 .big5 AddCharset WINDOWS-1251 .cp-1251 .win-1251 AddCharset CP866 .cp866 AddCharset KOI8-r .koi8-r .koi8-ru AddCharset KOI8-ru .koi8-uk .ua AddCharset ISO-10646-UCS-2 .ucs2 AddCharset ISO-10646-UCS-4 .ucs4 AddCharset UTF-8 .utf8 AddCharset GB2312 .gb2312 .gb AddCharset utf-7 .utf7 AddCharset utf-8 .utf8 AddCharset big5 .big5 .b5 AddCharset EUC-TW .euc-tw AddCharset EUC-JP .euc-jp AddCharset EUC-KR .euc-kr AddCharset shift_jis .sjis AddType application/x-tar .tgz AddType image/x-icon .ico AddHandler type-map var AddOutputFilter INCLUDES .shtml <IfModule mod_negotiation.c> <IfModule mod_include.c> Alias /error/ "/export/home/webadmin/htdocs/error_html/" <Directory "/export/home/webadmin/htdocs/error_html"> AllowOverride Limit AuthConfig Options IncludesNoExec AddOutputFilter Includes html AddHandler type-map var Order allow,deny Allow from all LanguagePriority en es de fr ForceLanguagePriority Prefer Fallback </Directory> ErrorDocument 400 /error/error_400.shtml ErrorDocument 401 /error/error_401.shtml ErrorDocument 403 /error/error_403.shtml ErrorDocument 404 /error/error_404.html ErrorDocument 405 /error/error_405.html ErrorDocument 408 /error/error_408.html ErrorDocument 410 /error/error_410.html ErrorDocument 411 /error/error_411.html ErrorDocument 412 /error/error_412.html ErrorDocument 413 /error/error_413.html ErrorDocument 414 /error/error_414.html ErrorDocument 415 /error/error_415.html ErrorDocument 500 /error/error_500.html ErrorDocument 501 /error/HTTP_NOT_IMPLEMENTED.html.var ErrorDocument 502 /error/HTTP_BAD_GATEWAY.html.var ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var </IfModule> </IfModule> BrowserMatch "Mozilla/2" nokeepalive BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0 BrowserMatch "RealPlayer 4\.0" force-response-1.0 BrowserMatch "Java/1\.0" force-response-1.0 BrowserMatch "JDK/1\.0" force-response-1.0 BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully BrowserMatch "^WebDrive" redirect-carefully BrowserMatch "^WebDAVFS/1.[012]" redirect-carefully BrowserMatch "^gnome-vfs" redirect-carefully <Location /~*/> Deny from all </Location> <IfModule mod_ssl.c> Include conf/ssl.conf </IfModule> ### Section 3: Virtual Hosts NameVirtualHost 192.168.0.150 <VirtualHost 192.168.0.150> ServerName www.domain1.com ServerAdmin you@domain1.com DocumentRoot /export/home/webadmin/htdocs ErrorLog /var/log/apache/error_log SetEnvIf Request_URI \.gif$ gif-image CustomLog /var/log/apache/access_log "%h %l %u %t \"%r\" %s %b \"%{User-Agent}i\" %{Referer}i\"" env=!gif-image SetOutputFilter DEFLATE </VirtualHost> <VirtualHost 192.168.0.150> ServerName domain2.tv ServerAdmin you@domain1.com DocumentRoot /export/home/domain2/public_html ErrorLog /export/home/domain2/log/domain2_error_log SetEnvIf Request_URI "\.(gif)|(jpg)$" object-is-image CustomLog /export/home/domain2/log/domain2_access_log "%h %l %u %t \"%r\" %s %b \"%{User-Agent}i\" %{Referer}i\"" env=!object-is-image SetOutputFilter DEFLATE </VirtualHost> <VirtualHost 192.168.0.150> ServerName www.domain2.tv ServerAdmin you@domain1.com DocumentRoot /export/home/domain2/public_html ErrorLog /export/home/domain2/log/domain2_error_log SetEnvIf Request_URI "\.(gif)|(jpg)$" object-is-image CustomLog /export/home/domain2/log/domain2_access_log "%h %l %u %t \"%r\" %s %b \"%{User-Agent}i\" %{Referer}i\"" env=!object-is-image SetOutputFilter DEFLATE </VirtualHost> <VirtualHost 192.168.0.150> ServerName domain3.net ServerAdmin you@domain1.com DocumentRoot /export/home/domain3/public_html ErrorLog /export/home/domain3/log/domain3_error_log SetEnvIf Request_URI "\.(gif)|(jpg)$" object-is-image CustomLog /export/home/domain3/log/domain3_access_log "%h %l %u %t \"%r\" %s %b \"%{User-Agent}i\" %{Referer}i\"" env=!object-is-image SetOutputFilter DEFLATE </VirtualHost> <VirtualHost 192.168.0.150> ServerName domain4.com ServerAdmin you@domain1.com DocumentRoot /export/home/domain4/htdocs ErrorLog /export/home/domain4/log/domain4_error_log SetEnvIf Request_URI "\.(gif)|(jpg)$" object-is-image CustomLog /export/home/domain4/log/domain4_access_log "%h %l %u %t \"%r\" %s %b \"%{User-Agent}i\" %{Referer}i\"" env=!object-is-image SetOutputFilter DEFLATE </VirtualHost> <VirtualHost 192.168.0.150> ServerName www.domain4.com ServerAdmin you@domain1.com DocumentRoot /export/home/domain4/htdocs ErrorLog /export/home/domain4/log/domain4_error_log SetEnvIf Request_URI "\.(gif)|(jpg)$" object-is-image CustomLog /export/home/domain4/log/domain4_access_log "%h %l %u %t \"%r\" %s %b \"%{User-Agent}i\" %{Referer}i\"" env=!object-is-image SetOutputFilter DEFLATE </VirtualHost> =========================================================== ssl.confを修正する 念のためデフォルトのssl.confのバックアップを取っておく # cp /usr/local/apache2/conf/ssl.conf /usr/local/apache2/conf/ssl.conf.default viでssl.confを開く # vi /usr/local/apache2/conf/ssl.conf 以下の"赤字"の部分を書き換えて保存する =========================================================== <IfDefine SSL> Listen 443 AddType application/x-x509-ca-cert .crt AddType application/x-pkcs7-crl .crl SSLPassPhraseDialog builtin SSLSessionCache dbm:logs/ssl_scache SSLSessionCacheTimeout 300 SSLMutex file:logs/ssl_mutex SSLRandomSeed startup builtin SSLRandomSeed connect builtin #SSLLog logs/ssl_engine_log #SSLLogLevel info <VirtualHost 192.168.0.150:443> DocumentRoot "/export/home/webadminr/ssl_htdocs" ServerName www.domain1.com:443 ServerAdmin you@domain1.com ErrorLog logs/error_log TransferLog logs/access_log SSLEngine on SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL #SSLCertificateFile /usr/local/apache2/conf/ssl.crt/server.crt SSLCertificateFile /usr/local/ssl/certs/cert.pem #SSLCertificateKeyFile /usr/local/apache2/conf/ssl.key/server.key SSLCertificateKeyFile /usr/local/ssl/private/key2.pem <Files ~ "\.(cgi|shtml|phtml|php3?)$"> SSLOptions +StdEnvVars </Files> <Directory "/usr/local/apache2/cgi-bin"> SSLOptions +StdEnvVars </Directory> <Directory "/export/home/webadmin/ssl_htdocs"> Order allow,deny Allow from all AllowOverride AuthConfig Limit Options -Indexes FollowSymLinks MultiViews ExecCGI Includes AddHandler cgi-script .cgi AddHandler server-parsed .shtml AddType text/html .shtml AddType application/x-httpd-cgi .cgi AddType application/x-httpd-cgi .pl <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> DirectoryIndex index.html index.htm index.shtml index.cgi welcome.html welcome.htm SetEnvIf User-Agent ".*MSIE.*" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 CustomLog logs/ssl_request_log \ "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b" ######################### #### For analog-5.22 #### ######################### Alias /analog/ "/usr/local/analog-5.22/" AddHandler cgi-script .cgi .pl <Directory "/usr/local/analog-5.22"> Options ExecCGI MultiViews AllowOverride AuthConfig Order allow,deny Allow from all </Directory> <IfModule mod_dir.c> DirectoryIndex index.html index.htm index.shtml index.cgi welcome.html welcome.htm </IfModule> AddOutputFilter INCLUDES .shtml </VirtualHost> </IfDefine> =========================================================== httpd の起動 ログ用ディレクトリを作成しておく # mkdir /var/log/apache デフォルトのログファイルを作成したディレクトリにコピーしておく # cp /usr/local/apache2/logs/* /var/log/apache/ apacheの起動スクリプトを/etc/init.d/にコピーする # cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd コピーした起動スクリプトを編集する # vi /etc/init.d/httpd 起動時にSSLも読み込むようにstartの部分を以下のように書き換えて保存する start) if [ $RUNNING -eq 1 ]; then echo "$0 $ARG: httpd (pid $PID) already running" continue fi if $HTTPD -DSSL; then echo "$0 $ARG: httpd started" else echo "$0 $ARG: httpd could not be started" ERROR=3 fi ;; ディレクトリを移動する # cd /etc/rc2.d/ 起動スクリプトのシンボリックリンクを張る # ln -s ../init.d/httpd ./S78httpd 起動させる # /etc/rc2.d/S78httpd start # exit