Fedora 31
Sponsored Link

Apache httpd : インストール2019/11/19

 
Apache httpd をインストールして Web サーバーを構築します。
[1] httpd をインストールします。
[root@www ~]#
dnf -y install httpd
# ウェルカムページはリネーム または 削除

[root@www ~]#
mv /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.d/welcome.conf.org

[2] httpd の設定です。サーバーの名前等は自身の環境に置き換えてください。
[root@www ~]#
vi /etc/httpd/conf/httpd.conf
# 89行目:管理者アドレス指定

ServerAdmin
root@srv.world
# 98行目:コメント解除しサーバー名指定

ServerName
www.srv.world:80
# 147行目:変更 (Indexes は削除)

Options FollowSymLinks
# 154行目:変更

AllowOverride
All
# 167行目:必要に応じて追記 (ディレクトリ名のみでアクセスできるファイル名)

DirectoryIndex index.html
index.php index.cgi
# 最終行に追記

# サーバーの応答ヘッダ

ServerTokens Prod
[root@www ~]#
systemctl enable --now httpd

[3] Firewalld を有効にしている場合は HTTP サービスの許可が必要です。HTTP は [80/TCP] を使用します。
[root@www ~]#
firewall-cmd --add-service=http --permanent

success
[root@www ~]#
firewall-cmd --reload

success
[4] HTML テストページを作成して動作確認をします。クライアント PC で Web ブラウザを起動し、以下のように作成したテストページにアクセスできれば OK です。
[root@www ~]#
vi /var/www/html/index.html
<html>
<body>
<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">
Test Page
</div>
</body>
</html>
関連コンテンツ