LoginSignup
9
9

More than 5 years have passed since last update.

【Apache】Apacheをインストールしたら知っておきたい設定項目

Posted at

前提

CentOS6.5で動作確認をしています。
初心者を想定して記述しているドキュメントとなっています。
開発用サーバとして動かすこと前提に記述しています。

Apacheのインストールと初期設定

Apacheのインストール

# yum install httpd httpd-devel -y  # Apache(httpd)をインストール

Apacheの起動

# service httpd start       # Apacheを起動

自動起動の設定

# chkconfig httpd on        # Apacheの自動起動を設定

Apacheの設定ファイルを確認

Apacheの設定ファイルのオリジナルをバックアップ

# cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.origin   # httpd.conf.originという名前でオリジナルの設定ファイルをバックアップ

ドキュメントルートの設定

ドキュメントルートとは、ブラウザからアクセスした時にApacheがまずプログラムファイルを探しに行くディレクトリのこと。
デフォルトの設定では292行目になってます。

DocumentRoot "/var/www/html/"

ディレクトリディレクティブの設定

<Directory "/var/www/html">


</Directory>

ディレクトリインデックス

設定例:

DirectoryIndex index.html index.php

サーバシグネチャの設定(セキュリティ的な観点から)

推奨設定:

ServerSignature Off
9
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
9