Rocky Linux 8.5にhttpd をインストールする

OSバージョンの確認

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# cat /etc/redhat-release
Rocky Linux release 8.5 (Green Obsidian)
# cat /etc/redhat-release Rocky Linux release 8.5 (Green Obsidian)
# cat /etc/redhat-release
Rocky Linux release 8.5 (Green Obsidian)

インストールの方法
1.httpdをインストールします
# dnf -y install httpd

2.httpdの設定ファイルを編集します
# vi /etc/httpd/conf/httpd.conf

89行目
修正前
ServerAdmin root@localhost
修正後
ServerAdmin 管理者アドレス

98行目
修正前
#ServerName www.example.com:80
修正後
#ServerName サーバー名:80

147行目
修正前
Options Indexes FollowSymLinks
修正後
Options FollowSymLinks

154行目
修正前
AllowOverride None
修正後
AllowOverride All

166行目
修正前
DirectoryIndex index.html
修正後
DirectoryIndex index.html index.php
最終行に以下の内容を追記します
ServerTokens Prod

3.HTTPサービスの許可を行う

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# firewall-cmd --add-service=http
success
# firewall-cmd --runtime-to-permanent
success
# firewall-cmd --add-service=http success # firewall-cmd --runtime-to-permanent success
# firewall-cmd --add-service=http
success
# firewall-cmd --runtime-to-permanent
success

4.httpdを起動します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# systemctl enable --now httpd
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service
→ /usr/lib/systemd/system/httpd.service.
# systemctl enable --now httpd Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
# systemctl enable --now httpd
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service
→ /usr/lib/systemd/system/httpd.service.

httpdバージョンの確認
# httpd -v
Server version: Apache/2.4.37 (rocky)
Server built: Nov 15 2021 03:12:26

5.動作確認
http://192.168.229.132/でアクセスします
「HTTP Server Test Page」画面が表示されます。

Rocky Linux 8

Posted by arkgame