やんちのプログラミングメモ

こんにちは、こちらはやんちのウェブページです。
このページにはやんちがプログラミング中に使用するメモを載せて行く予定です。

Apache HTTP Server を CentOS にセットアップしてみよう。

現在の Apache HTTP Server のインストール状況を調べる

rpm -qa | grep httpd<Enter>
httpd-2.2.3-11.el5_2.centos.4           ← HTTP Server 本体
httpd-manual-2.2.3-11.el5_2.centos.4    ← 説明書
httpd-devel-2.2.3-11.el5_2.centos.4     ← 開発環境
system-config-httpd-1.3.3.3-1.el5       ← 設定ツール

既に、Apache HTTP Server 2.2.3-11 はインストール済みでした。

yum を使い、パッケージを検索

Apache HTTP サーバがまだインストールされていない場合は、yum を使い、 インストール可能なパッケージを検索します。
yum search httpd<Enter>
Loading "fastestmirror" plugin
Determining fastest mirrors
 * base: ftp.oss.eznetsols.org
 * updates: ftp.oss.eznetsols.org
 * addons: ftp.oss.eznetsols.org
 * extras: ftp.oss.eznetsols.org
base                      100% |=========================| 1.1 kB    00:00
updates                   100% |=========================|  951 B    00:00
addons                    100% |=========================|  951 B    00:00
extras                    100% |=========================| 1.1 kB    00:00
httpd-devel.i386 : Development tools for the Apache HTTP server.
httpd-devel.i386 : Development tools for the Apache HTTP server.
httpd-manual.i386 : Apache HTTP サーバーのドキュメント。
system-config-httpd.noarch : Apache 設定ツール
httpd-devel.i386 : Apache HTTP サーバー用の開発ツール。
httpd-manual.i386 : Documentation for the Apache HTTP server.
mod_ssl.i386 : SSL/TLS module for the Apache HTTP server
httpd.i386 : Apache HTTP Server
system-config-httpd.noarch : Apache configuration tool
mod_ssl.i386 : SSL/TLS module for the Apache HTTP server
httpd-manual.i386 : Documentation for the Apache HTTP server.
httpd.i386 : Apache HTTP Server
mod_ssl.i386 : Apache HTTP Server 用 SSL/TLS モジュール
mod_ssl.i386 : SSL/TLS module for the Apache HTTP server
httpd-devel.i386 : Development tools for the Apache HTTP server.
mod_dav_svn.i386 : Apache server module for Subversion server.
httpd.i386 : Apache HTTP Server
httpd-manual.i386 : Documentation for the Apache HTTP server.
httpd.i386 : Apache HTTP Server

いくつかのパッケージが見つかりました。 パッケージ名が重複している物もありますが、今回は気にしない事にします。

「Apache HTTP Server 本体」をインストール

# yum install httpd<Enter>

「Apache HTTP サーバのドキュメント。」をインストール

# yum install httpd-manual<Enter>

「Delevopment tool for the Apache HTTP Server」をインストール

# yum install httpd-devel<Enter>

「Apache 設定ツール」をインストール

# yum install system-config-httpd<Enter>

「Apache HTTP Server 用 SSL/TLS」モジュール をインストール

# yum install mod_ssl<Enter>

Apache HTTP Server の設定

Apache HTTP Server の設定ファイルは、 「/etc/httpd/conf/httpd.conf」 と、 「/etc/httpd/conf.d/」ディレクトリにあります。

サーバ管理者のメールアドレスを設定。「/etc/httpd/conf/httpd.conf」を編集
# ServerAdmin root@localhost
ServerAdmin サーバ管理者のメールアドレス

サーバ名を設定。「/etc/httpd/conf/httpd.conf」を編集
# ServerName www.example.com:80
ServerName サーバ名:80

コマンド

start, stop, restart, condrestart, reload, status, fullstatus, graceful, help, configtest

サーバを起動

# /etc/init.d/httpd start<Enter>

サーバを停止

# /etc/init.d/httpd stop<Enter>

サーバを再起動

# /etc/init.d/httpd restart<Enter>

動作確認環境:
CentOS5.2(Linux)
Apache HTTP Server 2.2.3-11

・2009-01-08

右サイドメニュー