Dell Optiplex GXa Solaris 8  x86  6/00

戻る




Apache/2.0.40 (Unix) mod_perl/1.99_05-dev Perl/v5.8.0 
mod_ssl/2.0.40 OpenSSL/0.9.6g DAV/2


※後に現在の最新の、
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.53
	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



必要なソフトウェア:

httpd-2.0.40.tar.gz	(09-Aug-2002 Rerease)
http://www.apache.org/dist/httpd/

openssl-engine-0.9.6g.tar.gz
http://www.openssl.org/source/  (最近ここのサーバーは死んでる事が多い)

mod_perl-1.99_05.tar.gz	(20-Aug-2002 Rerease)
http://perl.apache.org/dist/



準備

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

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



OpenSSL (0.9.6g) のインストール

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

解凍展開する。
	$ tar xozf ./openssl-engine-0.9.6g.tar.gz

SuperUserになる。
	$ su
	password:

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

解凍展開されたディレクトリに移る。
	# cd openssl-engine-0.9.6g

最適化する。
	# ./config

コンパイルする。
	# make

テストする。
	# make test
	
===============================================
Approximate total server time:   0.44 s
Approximate total client time:   1.27 s
make[1]: Leaving directory `/opt/src/apache1.3.24/openssl-engine-0.9.6e/test'
OpenSSL 0.9.6g [engine] 21 dec 2001
built on: 2002年03月030日 (土) 00時15分53秒 JST
platform: solaris-x86-gcc
options:  bn(64,32) md2(int) rc4(idx,int) des(ptr,risc1,16,long) idea(int) blowf
ish(idx)
compiler: gcc -fPIC -DTHREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -fomit
-frame-pointer -m486 -Wall -DL_ENDIAN -DNO_INLINE_ASM -DSHA1_ASM -DMD5_ASM -DRMD
160_ASM
===============================================


ってなメッセージが出れば成功。


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

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

出来上がったライブラリをそれぞれ/usr/local/lib内にコピー。
	# cp libRSAglue.a /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.6 /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.6 /usr/local/lib/

コピーしたライブラリのシンボリックリンクを/usr/lib/内に張る。
	# ln -s /usr/local/lib/libRSAglue.a /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.6 /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.6 /usr/lib/

一般ユーザーに戻る。
	# exit



apacheの解凍展開とソースの書き換え

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

解凍展開しておく。
	$ tar xozf httpd-2.0.40.tar.gz

セキュリティ を高めるため、HTTPでアクセスされた時の応答メッセージ
(httpd名とバージョン)を変える。
もしも自分が使っているバージョンにセキュリティホールが見つかってしまっ
た場合、クラッカーはその情報を元に攻撃を仕掛けてくる可能性があるので、
ソースを少々書き換えて、表示させるhttpd名とバージョンを架空のHTTPDにして
しまう。

展開したディレクトリのincludeディレクトリに移動する。
	$ cd httpd-2.0.40/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_BASEREVISION "2.0.40"
	#define AP_SERVER_BASEVERSION AP_SERVER_BASEPRODUCT "/"AP_SERVER_BASEREVISION
	#define AP_SERVER_VERSION  AP_SERVER_BASEVERSION

	/* ### 変更後例 ### */
	#define AP_SERVER_BASEVENDOR "MicroGates IIS"
	#define AP_SERVER_BASEPRODUCT "Netscape-Entersurprise"
	#define AP_SERVER_BASEREVISION "7.0"
	#define AP_SERVER_BASEVERSION AP_SERVER_BASEPRODUCT "/"AP_SERVER_BASEREVISION
	#define AP_SERVER_VERSION  AP_SERVER_BASEVERSION

  ※後のconfigureでモジュールを含めた場合は、httpd.confに
   「ServerTokens ProductOnly」 を記述することを忘れずに。
  
  ※ちなみに、Apache-1.3.26では、apache_1.3.26/src/include/httpd.hの
    428行目から431行目にある。




Apache/2.0.40のインストール


	※ある程度日本語化したマニュアルが
	http://httpd.apache.org/docs-2.0/にある。


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

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_05のインストール 作業ディレクトリに戻る。 $ cd /opt/src/apache-2.0.40/ mod_perlのアーカイブをダウンロードする。 $ wget http://perl.apache.org/dist/mod_perl-1.99_05.tar.gz ダウンロードしたアーカイブを解凍展開する。 $ tar xozf ./mod_perl-1.99_05.tar.gz 展開したディレクトリに移動する。 cd mod_perl-1.99_05 perlで書かれた最適化スクリプトを走らせる。 $ /usr/local/bleedperl/bin/perl Makefile.PL MP_AP_PREFIX=/usr/local/apache2 コンパイルする。 $ make SuperUserになる。 $ su password: インストールする。 # make install 証明書発行 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を許可するディレクトリなどは慎重にセキュリティポリシーを考える) =========================================================== ServerRoot "/usr/local/apache2" ServerTokens ProductOnly <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 logs/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> Listen 80 LoadModule perl_module modules/mod_perl.so <IfModule !mpm_winnt.c> <IfModule !mpm_netware.c> User nobody #Group #-1 Group nobody </IfModule> </IfModule> ServerAdmin you@domain1.com ServerName www.domain1.com:80 UseCanonicalName On DocumentRoot "/export/home/webmaster/htdocs" <Directory /> Options FollowSymLinks AllowOverride AuthConfig Limit </Directory> <Directory "/export/home/webmaster/htdocs"> 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 AllowOverride None Order allow,deny Allow from all </Directory> UserDir /export/home/*/public_html <Directory /export/home/*/public_html> 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 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 welcome.html welcome.htm 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 #CustomLog logs/access_log common CustomLog /var/log/apache/access_log "%h %l %u %t \"%r\" %s %b \"%{User-Agent}i\" %{Referer}i\"" 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 AllowOverride None Order allow,deny Allow from all </Directory> ScriptAlias /cgi-bin/ "/export/home/webmaster/cgi-bin/" <IfModule mod_cgid.c> Scriptsock <path> </IfModule> whatever your ScriptAliased <Directory "/export/home/webmaster/cgi-bin"> AllowOverride None Options -Indexes FollowSymLinks MultiViews ExecCGI Includes AddHandler cgi-script .cgi AddHandler server-parsed .shtml AddType application/x-httpd-cgi .cgi AddType application/x-httpd-cgi .pl Order allow,deny Allow from all </Directory> IndexOptions FancyIndexing VersionSort 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 kr .kr 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 kr no pl pt pt-br ltz ca es sv tw ForceLanguagePriority Prefer Fallback AddDefaultCharset ISO-8859-1 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 # For russian, more than one charset is used (depends on client, mostly): 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 AddHandler type-map var <IfModule mod_negotiation.c> <IfModule mod_include.c> Alias /error/ "/usr/local/apache2/error/" <Directory "/usr/local/apache2/error"> AllowOverride None 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/HTTP_BAD_REQUEST.html.var ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var ErrorDocument 410 /error/HTTP_GONE.html.var ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var ErrorDocument 415 /error/HTTP_SERVICE_UNAVAILABLE.html.var ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var 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 <Location /server-status> SetHandler server-status Order deny,allow Deny from all Allow from .domain1.com </Location> <Location /server-info> SetHandler server-info Order deny,allow Deny from all Allow from .domain1.com </Location> <Location /~*/> Deny from all </Location> <IfModule mod_ssl.c> Include conf/ssl.conf </IfModule> #NameVirtualHost * NameVirtualHost 192.168.0.150 <VirtualHost 192.168.0.150> ServerName www.domain1.com ServerAdmin you@domain1.com DocumentRoot /export/home/webmaster/htdocs ErrorLog /var/log/apache/error_log CustomLog /var/log/apache/access_log "%h %l %u %t \"%r\" %s %b \"%{User-Agent}i\" %{Referer}i\"" CustomLog /var/log/apache/gzip.log gzip_info Options +FollowSymLinks AddLanguage ja .ja AddCharset EUC-JP .euc AddCharset ISO-2022-JP .jis AddCharset SHIFT_JIS .sjis SetEnv gzip-only-text/html 1 SetOutputFilter DEFLATE </VirtualHost> <VirtualHost 192.168.0.150> ServerName domain2.tv ServerAdmin you@domain1.com DocumentRoot /export/home/user/public_html ErrorLog /export/home/user/log/user_error_log CustomLog /export/home/user/log/user_access_log "%h %l %u %t \"%r\" %s %b \"%{User-Agent}i\" %{Referer}i\"" SetEnv gzip-only-text/html 1 SetOutputFilter DEFLATE </VirtualHost> <VirtualHost 192.168.0.150> ServerName www.domain2.tv ServerAdmin you@domain2.com DocumentRoot /export/home/user/public_html ErrorLog /export/home/user/log/user_error_log CustomLog /export/home/user/log/user_access_log "%h %l %u %t \"%r\" %s %b \"%{User-Agent}i\" %{Referer}i\"" SetEnv gzip-only-text/html 1 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/webmaster/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/webmaster/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