- apacheをインストール
VineLinuxインストール時にインターネットサーバーのオプションをつけた場合既にインストールされていますので下記のような画面がでます。もしオプションを付け忘れたり、Vineインストール時に最小インストールを選択した場合は
apt-get install apache でインストールできると思います(先に入れてしまったので実践してません)
インストールは管理者でおこないますのでsuコマンドで管理者になっておきます。
[ustyle@serredli ustyle]$ su
Password:
[root@serredli ustyle]# apt-get install apache
パッケージリストを読みこんでいます... 完了
依存情報ツリーを作成しています... 完了
* apache は既に最新バージョンがインストールされています。
アップグレード: 0 個, 新規インストール: 0 個, 削除: 0 個, 保留: 0 個
[root@serredli ustyle]#
[root@serredli ustyle]# |
- apacheの基本的な設定
設定は下記のファイルを修正して行います。(私は変更しませんでした。以下編集の仕方の説明となります。設定値については少しですが備考にまとめましたので参考程度にご覧下さい)
/etc/httpd/conf/httpd.conf
[root@serredli ustyle]# cd /etc/httpd/conf/
[root@serredli conf]# vi httpd.conf |
実行すると下記のようなファイルが開きます。
設定はエディタというものを利用します。ここではviというエディタを使っていますが使い方は初心者にはわかりにくいです。グラフィカル環境であればGnomeエディタが利用しやすいと思います。
- 画面左上の「アプリケーション」をクリック
- 「アクセサリ」
- 開いた中からGnomeテキスト・エディタを開く
- 上記の/etc/httpd/conf/httpd.confを開く
下記はVIを開いた画面です。
##
## httpd.conf -- Apache HTTP server configuration file
##
#
# Based upon the NCSA server configuration files originally by Rob McCool.
#
# This is the main Apache server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://www.apache.org/docs/> for detailed information about
# the directives.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
#
# After this file is processed, the server will look for and process
# /usr/conf/srm.conf and then /usr/conf/access.conf
# unless you have overridden these with ResourceConfig and/or
# AccessConfig directives here.
#
# The configuration directives are grouped into three basic sections:
# 1. Directives that control the operation of the Apache server process as a
# whole (the 'global environment').
# 2. Directives that define the parameters of the 'main' or 'default' server,
# which responds to requests that aren't handled by a virtual host.
# These directives also provide default values for the settings
# of all virtual hosts.
# 3. Settings for virtual hosts, which allow Web requests to be sent to
# different IP addresses or hostnames and have them handled by the
# same Apache server process.
#
# Configuration and logfile names: If the filenames you specify for many
# |
いろいろかかれていて設定もいろいろできるのですが私はとりあえず何も設定しなくて利用しています。あえて言うならばサーバー管理者名、連絡先の設定ですが本格的に運営をするなら必要ですが私自身学習用としてつかってますので設定しませんでした。もしメールアドレスを設定するのであれば別にひとつメールアドレスを作っておき自分のプライベート用とは分けたほうがよいかもしれません。定かではないのですが以前メールアドレス設定したとき迷惑メール(特に英語)が頻繁にくるようになった気がします。他でそのメールアドレスを使っていたのでなんともいえませんがメールアドレスを公開するのと一緒だと思ったほうが良いと思います。
あとディレクトリは何も設定しなければ /home/httpd/htmlが割り当てられます。ここのファイルがインターネット上で公開されます。もしこの場所を変えたかったら
先ほどのhttpd.confを開き
DocumentRoot /home/httpd/html
とかかれている場所を変更します。
apacheは本当にいろいろな設定ができて、例えば特定の人のみを受け付けるとか、PHPを動かすとかできます。まだまだぜんぜん理解していないのですが下の備考にわかる範囲でそれぞれの設定値の内容上げましたので参考にして下さい。
|