Apacheインストール

Apacheをインストールします。
# yum -y install httpd

コンフィグファイルのバックアップを取得してから、内容を修正します。

# cp -p /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.org
# vi /etc/httpd/conf/httpd.conf
95行目ホストネーム指定
#ServerName www.example.com:80
ServerName HOSTNAME
151行目.htaccessを読み込むよう変更
AllowOverride None
AllowOverride All
164行目 ディレクトリのみでアクセスできるようファイル名を記入
DirectoryIndex index.html index.php
最終行 HTTP通信の持続的な接続できるよう追記
KeepAlive On

バージョンを確認します。
# httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built: Jul 18 2016 15:30:14

下記コマンドを実行して、Firewallでhttp通信を許可する設定をします。
# systemctl enable firewalld
# systemctl start firewalld
# firewall-cmd --add-service=http --permanent
# firewall-cmd --reload
# firewall-cmd --list-all

httpdを起動します。
# systemctl enable httpd
# systemctl start httpd

テストページを作成します。
# vi /var/www/html/index.html

<div style="width: 100%; font-size: 40px; text-align: center;">Test page</div>

 

ブラウザからIPアドレス or HOSTNAMEを入力して、テストページが表示されるか、確認してください。
http://IPアドレス or HOSTNAME