Apache: 2006年4月アーカイブ

■環境変数にPATHとLD_LIBRARY_PATHを追加する
PATH=/usr/bin:/usr/sbin:/usr/lib/lvm:/etc/lvm
	:/usr/local/sbin:/usr/local/bin
	:/usr/ccs/bin
	:/usr/local/ssl/bin
	:/usr/local/ssl/lib
	:/usr/local/apache/bin
LD_LIBRARY_PATH=/usr/local/ssl/lib
export PATH LD_LIBRARY_PATH
[root@www Source]# source /.bash_profile
■open_ssl mod_ssl apache を /usr/local/src/下に展開
[root@www src]# gunzip apache-1.3.27.tar.gz ;gunzip mod_ssl-2.8.12-1.3.27.tar.gz ;gunzip openssl-0.9.6i.tar.gz
[root@www src]# tar xvf apache-1.3.27.tar ;tar xvf mod_ssl-2.8.12-1.3.27.tar;tar xvf openssl-0.9.6i.tar

■gccとmakeのインストール

[root@www Binary]# gunzip gcc-2.95.3-sol8-sparc-local.gz
[root@www Binary]# gunzip make-3.80-sol9-sparc-local.gz
[root@www Binary]# pkgadd -d gcc-2.95.3-sol8-sparc-local

The following packages are available: 1 SMCgcc gcc (sparc) 2.95.3

Select package(s) you wish to process (or 'all' to process all packages). (default: all) [?,??,q]: all

Processing package instance from -sparc-local>

gcc (sparc) 2.95.3 Free Software Foundation Using as the package base directory. ## Processing package information. ## Processing system information. 6 package pathnames are already properly installed. ## Verifying disk space requirements. ## Checking for conflicts with packages already installed. ## Checking for setuid/setgid programs.

Installing gcc as

Installation of was successful.

[root@www Binary]# pkgadd -d make-3.80-sol9-sparc-local

The following packages are available: 1 SMCmake make (sparc) 3.80

Select package(s) you wish to process (or 'all' to process all packages). (default: all) [?,??,q]: all

Processing package instance from -sparc-local>

make (sparc) 3.80 Free Software Foundation Using as the package base directory. ## Processing package information. ## Processing system information. 5 package pathnames are already properly installed. ## Verifying disk space requirements. ## Checking for conflicts with packages already installed. ## Checking for setuid/setgid programs.

Installing make as

Installation of was successful.

■OpenSSLのインストール
[root@www openssl-0.9.6i]# ./config
[root@www openssl-0.9.6i]# make
[root@www openssl-0.9.6i]# make test
[root@www openssl-0.9.6i]# make install
■テストキーを試す
[root@www ssl]# openssl md5 * > rand.dat
[root@www ssl]# openssl genrsa -des3 -rand rand.dat -out server.key 1024
363 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:
[root@www ssl]# openssl rsa -in server.key -out server.key
read RSA key
Enter PEM pass phrase:
writing RSA key
[root@www ssl]# openssl req -new -key server.key -x509 -out server.crt
Using configuration from /usr/local/ssl/openssl.cnf
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.

Apacheのインストール

|

■インストールファイルはここ

Apache
http://www.apache.org/dist/httpd/
日本語解説サイト
http://www.apache.jp/docs/

OpenSSL / mod_ssl
ftp://ftp.infoscience.co.jp/pub/Crypto/SSL/
日本語解説サイト
http://japache.infoscience.co.jp/Apache-SSL/

PHP
http://www.php.net/downloads.php

■tar xvzf apache.tar.gz で解凍する

こんな感じのファイルが出来上がる。
ABOUT_APACHE  LICENSE        README-WIN.TXT    cgi-bin        configure  logs
Announcement  Makefile.tmpl  README.configure  conf           htdocs     src
INSTALL       README         WARNING-WIN.TXT   config.layout  icons 


■./configure

・どこにインストールされるのか心配だったらこのように試してみるとよい。  ちなみにlayoutファイルはconfig.layout
# ./configure --with-layout=RedHat --show-layout

・su_execをサポートする
http://www.apache.jp/docs/suexec.html
これも上記の方法でインストールディレクトリを確認できる

# ./configure --with-layout=RedHat --show-layout \ "--enable-suexec" \ "--suexec-caller=apache" \ "--suexec-docroot=/var/www/html" \ "--suexec-logfile=/var/log/httpd/suexec_log" \ "--suexec-uidmin=500" \ "--suexec-gidmin=500"

・DSOモジュールなどを組み込む http://www.apache.jp/docs/mod/index-bytype.html
"--enable-module=so" \      // これは必ず入れておく
"--enable-rule=SHARED_CORE" \  // ちょっとこれが意味不明だけど必要
"--enable-module=info" \     // サーバの設定情報 
"--enable-module=status" \    // サーバーのステータス
"--enable-module=rewrite" \   // 正規表現のURIからファイル名のマッピング機能
■ ./configure のオプション
--quiet   画面上にメッセージを表示しない   
--silent   quietと同じ   
--verbose   画面上に詳細なメッセージを表示   
--shadow[=DIR]   コンパイルに必要なファイルを指定したディレクトリ以下に作成   
--help   画面上にヘルプを表示   
--show-layout   画面上にApacheがインストールされるディレクトリを表示   
--with-layout=[F:]ID   指定したファイルの内容のとおりにApacheのファイルを配置する   
--target=TARGET   設定ファイルなどの名前を変更(httpd.conf→ichishi.confなど)   
--prefix=PREFIX   Apacheがインストールされるディレクトリを変更する   
--exec-prefix=EPREFIX   ファイルの種類別にディレクトリを指定する。変更後、どこにインストールされるかはshow-layoutで確認   
--bindir=DIR   
--sbindir=DIR   
--libexecdir=DIR   
--mandir=DIR   
--sysconfdir=DIR   
--datadir=DIR   
--iconsdir=DIR   
--htdocsdir=DIR   
--cgidir=DIR   
--includedir=DIR   
--localstatedir=DIR   
--runtimedir=DIR   
--logfiledir=DIR   
--proxycachedir=DIR   
--add-module=FILE   Apacheの標準以外のモジュールファイルを追加する   
--activate-module=FILE   
--permute-module=N1:N2   モジュールを組み込む順序を指定する   
--enable-module=NAME   指定したApacheの標準付属モジュールを組み込む   
--disable-module=NAME   指定したApacheの標準付属モジュールを組み込まない   
--enable-shared=NAME   指定したApacheの標準付属モジュールをDSO(補足3)で組み込む   
--disable-shared=NAME   指定したApacheの標準付属モジュールをDSOで組み込まない
    ■
モジュール   機能   デフォルト   
mod_access   ホストに基づいたアクセス制御   Yes   
mod_actions   ファイル種別/メソッドに基づいたスクリプトの実行   Yes   
mod_alias   Aliases   and   redirects.      Yes   
mod_asis   .asis   ファイルハンドラー      Yes   
mod_auth   テキストファイルを用いたユーザ認証      Yes   
mod_auth_anon   FTPスタイルの匿名(Anonymous)ユーザー認証      No   
mod_auth_db   バークレイDBファイルを用いたユーザー認証   No   
mod_auth_dbm   DBMファイルを用いたユーザー認証   No   
mod_autoindex   自動ディレクトリリスト表示      Yes   
mod_cern_meta   HTTPハンドラメタファイルのサポート   No   
mod_cgi   CGIスクリプトの実行      Yes   
mod_digest   MD5ユーザー認証   No   
mod_dir   基本的なディレクトリハンドリング      Yes   
mod_env   CGIスクリプトへの環境変数の継承      Yes   
mod_example   Apache   APIの実証   No   
mod_expires   割り当ての終了:リソースへのヘッダ      No   
mod_headers   リソースに任意のHTTPヘッダを加える   No   
mod_imap   イメージマップファイルのハンドラ   Yes   
mod_include   サーバで解析するドキュメント      Yes   
mod_info   サーバの設定情報      No   
mod_log_agent   ユーザーエージェントのログ蓄積      No   
mod_log_config   ユーザー定義ログ      Yes   
mod_log_referer   ドキュメントリファレンスのログ蓄積      No   
mod_mime   ファイル拡張子を使ったドキュメントタイプの決定      Yes   
mod_mime-magic   magic   numbers   を使ったドキュメントタイプの決定      No   
mod_negotiation   コンテンツのネゴシエーション      Yes   
mod_proxy   キャッシングプロキシ機能      No   
mod_rewrite   通常表記を使った強力なURI-to-filenameマッピング      No   
mod_setenvif   クライアント情報を基にした環境変数の設定      Yes   
mod_spelling   URLでのminor   typosの自動訂正      No   
mod_status   サーバステータスを表示      Yes   
mod_unique-id   あらゆるリクエストのためのユニークなリクエスト識別の生成      No   
mod_userdir   ユーザーのホーム・ディレクトリ      Yes   
mod_usertrack   cookieを用いたユーザー追跡(mod_cookies.cと置き換え)      No
■結果、これでconfigureをやってみる
# ./configure --with-layout=RedHat \
"--enable-suexec" \
"--suexec-caller=apache" \
"--suexec-docroot=/var/www/html" \
"--suexec-logfile=/var/log/httpd/suexec_log" \
"--suexec-uidmin=500" \
"--suexec-gidmin=500" \
"--enable-module=so" \
"--enable-rule=SHARED_CORE" \
"--enable-module=info" \
"--enable-module=status" \
"--enable-module=rewrite"
config.statusファイルとMakefile が出来上がるので
# make
# make install
+--------------------------------------------------------+
| You now have successfully built and installed the | Apache 1.3 HTTP 
| server. To verify that Apache actually | works correctly you now 
| should first check the | (initially created or preserved) 
| configuration files |
| |
| /etc/httpd/conf/httpd.conf
| |
| and then you should be able to immediately fire up | Apache the first 
| time by running: |
| |
| /usr/sbin/apachectl start
| |
| Thanks for using Apache. The Apache Group | http://www.apache.org/ |
+--------------------------------------------------------+
これでインストールが完了する。

■起動スクリプトの作成

通常、rpmでインストールすると、/etc/rc.d/init.d/にhttpdという
スクリプトが出来るので同様に作ってやればよい。

これを /etc/rc.d/rc3.d/S85httpd にシンボリックリンクを作る。
# ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc3.d/S85httpd
chkconfig --add httpd でもいいのか?

#!/bin/bash
#
# Startup script for the Apache Web Server # # chkconfig: - 85 15 # description: Apache is a World Wide Web server.  It is used to serve \
#              HTML files and CGI.
# processname: httpd
# pidfile: /var/run/httpd.pid
# config: /etc/httpd/conf/access.conf
# config: /etc/httpd/conf/httpd.conf
# config: /etc/httpd/conf/srm.conf

# Source function library. . /etc/rc.d/init.d/functions

# This will prevent initlog from swallowing up a pass-phrase prompt if # mod_ssl needs a pass-phrase from the user. INITLOG_ARGS=""

# Path to the apachectl script, server binary, and short-form for messages. apachectl=/usr/sbin/apachectl httpd=/usr/sbin/httpd prog=httpd RETVAL=0

# Find the installed modules and convert their names into arguments httpd # can use. moduleargs() { moduledir=/usr/lib/apache moduleargs=` /usr/bin/find ${moduledir} -type f -perm -0100 -name "*.so" | env -i tr '[:lower:]' '[:upper:]' | awk '{\ gsub(/.*\//,"");\ gsub(/^MOD_/,"");\ gsub(/^LIB/,"");\ gsub(/\.SO$/,"");\ print "-DHAVE_" $0}'` echo ${moduleargs} }

# The semantics of these two functions differ from the way apachectl does # things -- attempting to start while running is a failure, and shutdown # when not running is also a failure. So we just do it the way init scripts # are expected to behave here. start() { echo -n $"Starting $prog: " daemon $httpd `moduleargs` $OPTIONS RETVAL=$? echo [ $RETVAL = 0 ] && touch /var/lock/subsys/httpd return $RETVAL } stop() { echo -n $"Stopping $prog: " killproc $httpd RETVAL=$? echo [ $RETVAL = 0 ] && rm -f /var/lock/subsys/httpd /var/run/httpd.pid } reload() { echo -n $"Reloading $prog: " killproc $httpd -HUP RETVAL=$? echo }

# See how we were called. case "$1" in start) start ;; stop) stop ;; status) status $httpd RETVAL=$? ;; restart) stop start ;; condrestart) if [ -f /var/run/httpd.pid ] ; then stop start fi ;; reload) reload ;; graceful|help|configtest) $apachectl $@ RETVAL=$? ;; *) echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}" exit 1 esac

exit $RETVAL

このアーカイブについて

このページには、2006年4月以降に書かれたブログ記事のうちApacheカテゴリに属しているものが含まれています。

次のアーカイブはApache: 2006年5月です。

最近のコンテンツはインデックスページで見られます。過去に書かれたものはアーカイブのページで見られます。

Apache: 2006年4月: 月別アーカイブ

Powered by Movable Type 4.1