Fedora 37
Sponsored Link

Apache httpd : インストール2022/11/24

 
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
# 91行目 : 管理者アドレス指定

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

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

Options FollowSymLinks
# 156行目 : 変更

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

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

success
[root@www ~]#
firewall-cmd --runtime-to-permanent

success
[4] HTML テストページを作成して動作確認をします。クライアントコンピューターで 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>
関連コンテンツ