Fedora 36にApache2.4.53 をインストールする方法

環境
OSバージョンを確認します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# cat /etc/redhat-release
Fedora release 36 (Thirty Six)
# cat /etc/redhat-release Fedora release 36 (Thirty Six)
# cat /etc/redhat-release
Fedora release 36 (Thirty Six)

Apache httpdのインストール手順
1.Apacheをインストールします

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# dnf -y install httpd
# dnf -y install httpd
# dnf -y install httpd

httpdバージョンを確認します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# httpd -V
Server version: Apache/2.4.53 (Fedora Linux)
# httpd -V Server version: Apache/2.4.53 (Fedora Linux)
# httpd -V
Server version: Apache/2.4.53 (Fedora Linux)

2.サーバーの名前等を設定します
# vi /etc/httpd/conf/httpd.conf
91行目 管理者アドレスを指定
ServerAdmin contact@arkgame.com

100行目 メント解除しサーバーを指定

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
ServerName www.arkgame.com:80
ServerName www.arkgame.com:80
ServerName www.arkgame.com:80

149行目
修正前

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
Options Indexes FollowSymLinks
Options Indexes FollowSymLinks
Options Indexes FollowSymLinks

修正後

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
Options FollowSymLinks
Options FollowSymLinks
Options FollowSymLinks

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

169行目
修正前

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
DirectoryIndex index.html
DirectoryIndex index.html
DirectoryIndex index.html

修正後

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
DirectoryIndex index.html index.php index.cgi
DirectoryIndex index.html index.php index.cgi
DirectoryIndex index.html index.php index.cgi

最終行に以下の内容を追記します
ServerTokens Prod

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.

3.Firewalld を有効にしている場合は 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.テストページを作成します
# vi /var/www/html/index.html
以下の内容を追記します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<html>
<body>
<div>
Apache Test Page
</div>
</body>
</html>
<html> <body> <div> Apache Test Page </div> </body> </html>
<html>
<body>
<div>
Apache Test Page
</div>
</body>
</html>

5.動作確認

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
Webブラウザを起動し、http://192.168.71.128/にアクセスします。
「Apache Test Page」が表示されます。
Webブラウザを起動し、http://192.168.71.128/にアクセスします。 「Apache Test Page」が表示されます。
Webブラウザを起動し、http://192.168.71.128/にアクセスします。
「Apache Test Page」が表示されます。

 

Fedora 36

Posted by arkgame