そういうのがいいブログ

SIerで働く30代サラリーマンSEがインフラエンジニアに憧れてLinux・クラウド・AWSの勉強をするブログ

AlmaLinux 8 にApache2をインストールする手順

※[PR]当ブログの記事の中にはプロモーションが含まれています。

・AlmaLinux 8 にApache2をインストールする方法を知りたい。
・具体的な手順を分かりやすく教えてほしい。

こういった疑問に答えます。

本記事の内容

  1. AlmaLinux 8 にApache2をインストールする手順

サトナカ (@souiunogaii)

この記事を書いている私は、某SIerに勤務しながら、
WEB系エンジニア・インフラエンジニアに憧れて、プログラミングおよびインフラ技術の勉強をしています。

こういった私が、解説していきます。

私が実機で試したコマンドや画像を載せて書いています。
記事の信頼性担保に繋がると思います。

AlmaLinux 8 にApache2をインストールする手順

手順① Apache用ユーザー「www」の追加

今回は標準の実行ユーザー「apache」を使わずに、自分で作ったユーザー「www」を使います。

ユーザー追加とパスワード設定

useradd -s /sbin/nologin www
passwd www
[root@SV-ALTAIR ~]# useradd -s /sbin/nologin www
[root@SV-ALTAIR ~]# passwd www
ユーザー www のパスワードを変更。
新しいパスワード:   ←★★自分で決めたパスワード
新しいパスワードを再入力してください:  ←★★自分で決めたパスワード
passwd: すべての認証トークンが正しく更新できました。

確認

cat /etc/passwd | grep www
id www
[root@SV-ALTAIR ~]# cat /etc/passwd | grep www
www:x:1001:1001::/home/www:/sbin/nologin
[root@SV-ALTAIR ~]# id www
uid=1001(www) gid=1001(www) groups=1001(www)

手順② パッケージの事前確認

dnf list | grep httpd
[root@SV-ALTAIR ~]# dnf list | grep httpd
almalinux-logos-httpd.noarch                                      84.5-1.el8                                                 appstream
dmlite-apache-httpd.x86_64                                        1.15.2-15.el8                                              epel
httpd.x86_64                                                      2.4.37-56.module_el8.8.0+3560+c8e5e57e.6                   appstream
httpd-devel.x86_64                                                2.4.37-56.module_el8.8.0+3560+c8e5e57e.6                   appstream
httpd-filesystem.noarch                                           2.4.37-56.module_el8.8.0+3560+c8e5e57e.6                   appstream
httpd-manual.noarch                                               2.4.37-56.module_el8.8.0+3560+c8e5e57e.6                   appstream
httpd-tools.x86_64                                                2.4.37-56.module_el8.8.0+3560+c8e5e57e.6                   appstream
keycloak-httpd-client-install.noarch                              1.0-2.el8                                                  appstream
libmicrohttpd.i686                                                1:0.9.59-2.el8                                             baseos
libmicrohttpd.x86_64                                              1:0.9.59-2.el8                                             baseos
lighttpd.x86_64                                                   1.4.67-1.el8                                               epel
lighttpd-fastcgi.x86_64                                           1.4.67-1.el8                                               epel
lighttpd-filesystem.noarch                                        1.4.67-1.el8                                               epel
lighttpd-mod_authn_dbi.x86_64                                     1.4.67-1.el8                                               epel
lighttpd-mod_authn_gssapi.x86_64                                  1.4.67-1.el8                                               epel
lighttpd-mod_authn_ldap.x86_64                                    1.4.67-1.el8                                               epel
lighttpd-mod_authn_pam.x86_64                                     1.4.67-1.el8                                               epel
lighttpd-mod_authn_sasl.x86_64                                    1.4.67-1.el8                                               epel
lighttpd-mod_deflate.x86_64                                       1.4.67-1.el8                                               epel
lighttpd-mod_gnutls.x86_64                                        1.4.67-1.el8                                               epel
lighttpd-mod_magnet.x86_64                                        1.4.67-1.el8                                               epel
lighttpd-mod_maxminddb.x86_64                                     1.4.67-1.el8                                               epel
lighttpd-mod_mbedtls.x86_64                                       1.4.67-1.el8                                               epel
lighttpd-mod_nss.x86_64                                           1.4.67-1.el8                                               epel
lighttpd-mod_openssl.x86_64                                       1.4.67-1.el8                                               epel
lighttpd-mod_vhostdb_dbi.x86_64                                   1.4.67-1.el8                                               epel
lighttpd-mod_vhostdb_ldap.x86_64                                  1.4.67-1.el8                                               epel
lighttpd-mod_vhostdb_mysql.x86_64                                 1.4.67-1.el8                                               epel
lighttpd-mod_vhostdb_pgsql.x86_64                                 1.4.67-1.el8                                               epel
lighttpd-mod_webdav.x86_64                                        1.4.67-1.el8                                               epel
pagure-web-apache-httpd.noarch                                    5.13.3-2.el8                                               epel
python3-keycloak-httpd-client-install.noarch                      1.0-2.el8                                                  appstream
radicale3-httpd.noarch                                            3.1.8-52.el8                                               epel
sympa-httpd.x86_64                                                6.2.72-2.el8                                               epel
sympa-lighttpd.x86_64                                             6.2.72-2.el8                                               epel
sysusage-httpd.noarch                                             5.7-7.el8                                                  epel
thttpd.x86_64                                                     2.29-4.el8                                                 epel

手順③ Apacheインストール

インストール実行

dnf install httpd httpd-tools httpd-devel httpd-manual
[root@SV-ALTAIR ~]# dnf install httpd httpd-tools httpd-devel httpd-manual
メタデータの期限切れの最終確認: 2:17:34 前の 20230625213354秒 に実施しました。
依存関係が解決しました。
====================================================================================================
 パッケージ               Arch      バージョン                                   リポジトリー サイズ
====================================================================================================
インストール:
 httpd                    x86_64    2.4.37-56.module_el8.8.0+3560+c8e5e57e.6     appstream    1.4 M
 httpd-devel              x86_64    2.4.37-56.module_el8.8.0+3560+c8e5e57e.6     appstream    225 k
 httpd-manual             noarch    2.4.37-56.module_el8.8.0+3560+c8e5e57e.6     appstream    2.4 M
 httpd-tools              x86_64    2.4.37-56.module_el8.8.0+3560+c8e5e57e.6     appstream    109 k
依存関係のインストール:
 almalinux-logos-httpd    noarch    84.5-1.el8                                   appstream     29 k
 apr                      x86_64    1.6.3-12.el8                                 appstream    128 k
 apr-devel                x86_64    1.6.3-12.el8                                 appstream    245 k
 apr-util                 x86_64    1.6.1-6.el8_8.1                              appstream    104 k
 apr-util-devel           x86_64    1.6.1-6.el8_8.1                              appstream     85 k
 cyrus-sasl               x86_64    2.1.27-6.el8_5                               baseos        95 k
 cyrus-sasl-devel         x86_64    2.1.27-6.el8_5                               baseos       127 k
 expat-devel              x86_64    2.2.5-11.el8                                 baseos        56 k
 httpd-filesystem         noarch    2.4.37-56.module_el8.8.0+3560+c8e5e57e.6     appstream     42 k
 libdb-devel              x86_64    5.3.28-42.el8_4                              appstream     45 k
 mod_http2                x86_64    1.15.7-8.module_el8.8.0+3554+ec1058a7.3      appstream    154 k
 openldap-devel           x86_64    2.4.46-18.el8                                baseos       810 k
弱い依存関係のインストール:
 apr-util-bdb             x86_64    1.6.1-6.el8_8.1                              appstream     24 k
 apr-util-openssl         x86_64    1.6.1-6.el8_8.1                              appstream     26 k
モジュールストリームの有効化中:
 httpd                              2.4

トランザクションの概要
====================================================================================================
インストール  18 パッケージ

ダウンロードサイズの合計: 6.0 M
インストール後のサイズ: 19 M
これでよろしいですか? [y/N]: y

`

パッケージのダウンロード:
(1/18): expat-devel-2.2.5-11.el8.x86_64.rpm                         472 kB/s |  56 kB     00:00
(2/18): cyrus-sasl-devel-2.1.27-6.el8_5.x86_64.rpm                  985 kB/s | 127 kB     00:00
(3/18): cyrus-sasl-2.1.27-6.el8_5.x86_64.rpm                        698 kB/s |  95 kB     00:00
(4/18): openldap-devel-2.4.46-18.el8.x86_64.rpm                     4.7 MB/s | 810 kB     00:00
(5/18): almalinux-logos-httpd-84.5-1.el8.noarch.rpm                 104 kB/s |  29 kB     00:00
(6/18): apr-1.6.3-12.el8.x86_64.rpm                                 384 kB/s | 128 kB     00:00
(7/18): apr-util-1.6.1-6.el8_8.1.x86_64.rpm                         1.4 MB/s | 104 kB     00:00
(8/18): apr-devel-1.6.3-12.el8.x86_64.rpm                           1.2 MB/s | 245 kB     00:00
(9/18): apr-util-bdb-1.6.1-6.el8_8.1.x86_64.rpm                     680 kB/s |  24 kB     00:00
(10/18): apr-util-openssl-1.6.1-6.el8_8.1.x86_64.rpm                744 kB/s |  26 kB     00:00
(11/18): httpd-2.4.37-56.module_el8.8.0+3560+c8e5e57e.6.x86_64.rpm  6.4 MB/s | 1.4 MB     00:00
(12/18): httpd-filesystem-2.4.37-56.module_el8.8.0+3560+c8e5e57e.6. 480 kB/s |  42 kB     00:00
(13/18): apr-util-devel-1.6.1-6.el8_8.1.x86_64.rpm                  243 kB/s |  85 kB     00:00
(14/18): httpd-devel-2.4.37-56.module_el8.8.0+3560+c8e5e57e.6.x86_6 699 kB/s | 225 kB     00:00
(15/18): httpd-tools-2.4.37-56.module_el8.8.0+3560+c8e5e57e.6.x86_6 1.7 MB/s | 109 kB     00:00
(16/18): libdb-devel-5.3.28-42.el8_4.x86_64.rpm                     546 kB/s |  45 kB     00:00
(17/18): mod_http2-1.15.7-8.module_el8.8.0+3554+ec1058a7.3.x86_64.r 2.0 MB/s | 154 kB     00:00
(18/18): httpd-manual-2.4.37-56.module_el8.8.0+3560+c8e5e57e.6.noar 4.8 MB/s | 2.4 MB     00:00
----------------------------------------------------------------------------------------------------
合計                                                                1.9 MB/s | 6.0 MB     00:03
トランザクションの確認を実行中
トランザクションの確認に成功しました。
トランザクションのテストを実行中
トランザクションのテストに成功しました。
トランザクションを実行中
  準備             :                                                                            1/1
  インストール中   : apr-1.6.3-12.el8.x86_64                                                   1/18
  scriptletの実行中: apr-1.6.3-12.el8.x86_64                                                   1/18
  インストール中   : apr-util-bdb-1.6.1-6.el8_8.1.x86_64                                       2/18
  インストール中   : apr-util-openssl-1.6.1-6.el8_8.1.x86_64                                   3/18
  インストール中   : apr-util-1.6.1-6.el8_8.1.x86_64                                           4/18
  scriptletの実行中: apr-util-1.6.1-6.el8_8.1.x86_64                                           4/18
  インストール中   : apr-devel-1.6.3-12.el8.x86_64                                             5/18
  インストール中   : httpd-tools-2.4.37-56.module_el8.8.0+3560+c8e5e57e.6.x86_64               6/18
  インストール中   : libdb-devel-5.3.28-42.el8_4.x86_64                                        7/18
  scriptletの実行中: httpd-filesystem-2.4.37-56.module_el8.8.0+3560+c8e5e57e.6.noarch          8/18
  インストール中   : httpd-filesystem-2.4.37-56.module_el8.8.0+3560+c8e5e57e.6.noarch          8/18
  インストール中   : almalinux-logos-httpd-84.5-1.el8.noarch                                   9/18
  インストール中   : mod_http2-1.15.7-8.module_el8.8.0+3554+ec1058a7.3.x86_64                 10/18
  インストール中   : httpd-2.4.37-56.module_el8.8.0+3560+c8e5e57e.6.x86_64                    11/18
  scriptletの実行中: httpd-2.4.37-56.module_el8.8.0+3560+c8e5e57e.6.x86_64                    11/18
  インストール中   : expat-devel-2.2.5-11.el8.x86_64                                          12/18
  scriptletの実行中: cyrus-sasl-2.1.27-6.el8_5.x86_64                                         13/18
  インストール中   : cyrus-sasl-2.1.27-6.el8_5.x86_64                                         13/18
  scriptletの実行中: cyrus-sasl-2.1.27-6.el8_5.x86_64                                         13/18
  インストール中   : cyrus-sasl-devel-2.1.27-6.el8_5.x86_64                                   14/18
  インストール中   : openldap-devel-2.4.46-18.el8.x86_64                                      15/18
  インストール中   : apr-util-devel-1.6.1-6.el8_8.1.x86_64                                    16/18
  インストール中   : httpd-devel-2.4.37-56.module_el8.8.0+3560+c8e5e57e.6.x86_64              17/18
  インストール中   : httpd-manual-2.4.37-56.module_el8.8.0+3560+c8e5e57e.6.noarch             18/18
  scriptletの実行中: httpd-2.4.37-56.module_el8.8.0+3560+c8e5e57e.6.x86_64                    18/18
  scriptletの実行中: httpd-manual-2.4.37-56.module_el8.8.0+3560+c8e5e57e.6.noarch             18/18
  検証             : cyrus-sasl-2.1.27-6.el8_5.x86_64                                          1/18
  検証             : cyrus-sasl-devel-2.1.27-6.el8_5.x86_64                                    2/18
  検証             : expat-devel-2.2.5-11.el8.x86_64                                           3/18
  検証             : openldap-devel-2.4.46-18.el8.x86_64                                       4/18
  検証             : almalinux-logos-httpd-84.5-1.el8.noarch                                   5/18
  検証             : apr-1.6.3-12.el8.x86_64                                                   6/18
  検証             : apr-devel-1.6.3-12.el8.x86_64                                             7/18
  検証             : apr-util-1.6.1-6.el8_8.1.x86_64                                           8/18
  検証             : apr-util-bdb-1.6.1-6.el8_8.1.x86_64                                       9/18
  検証             : apr-util-devel-1.6.1-6.el8_8.1.x86_64                                    10/18
  検証             : apr-util-openssl-1.6.1-6.el8_8.1.x86_64                                  11/18
  検証             : httpd-2.4.37-56.module_el8.8.0+3560+c8e5e57e.6.x86_64                    12/18
  検証             : httpd-devel-2.4.37-56.module_el8.8.0+3560+c8e5e57e.6.x86_64              13/18
  検証             : httpd-filesystem-2.4.37-56.module_el8.8.0+3560+c8e5e57e.6.noarch         14/18
  検証             : httpd-manual-2.4.37-56.module_el8.8.0+3560+c8e5e57e.6.noarch             15/18
  検証             : httpd-tools-2.4.37-56.module_el8.8.0+3560+c8e5e57e.6.x86_64              16/18
  検証             : libdb-devel-5.3.28-42.el8_4.x86_64                                       17/18
  検証             : mod_http2-1.15.7-8.module_el8.8.0+3554+ec1058a7.3.x86_64                 18/18

インストール済み:
  almalinux-logos-httpd-84.5-1.el8.noarch
  apr-1.6.3-12.el8.x86_64
  apr-devel-1.6.3-12.el8.x86_64
  apr-util-1.6.1-6.el8_8.1.x86_64
  apr-util-bdb-1.6.1-6.el8_8.1.x86_64
  apr-util-devel-1.6.1-6.el8_8.1.x86_64
  apr-util-openssl-1.6.1-6.el8_8.1.x86_64
  cyrus-sasl-2.1.27-6.el8_5.x86_64
  cyrus-sasl-devel-2.1.27-6.el8_5.x86_64
  expat-devel-2.2.5-11.el8.x86_64
  httpd-2.4.37-56.module_el8.8.0+3560+c8e5e57e.6.x86_64
  httpd-devel-2.4.37-56.module_el8.8.0+3560+c8e5e57e.6.x86_64
  httpd-filesystem-2.4.37-56.module_el8.8.0+3560+c8e5e57e.6.noarch
  httpd-manual-2.4.37-56.module_el8.8.0+3560+c8e5e57e.6.noarch
  httpd-tools-2.4.37-56.module_el8.8.0+3560+c8e5e57e.6.x86_64
  libdb-devel-5.3.28-42.el8_4.x86_64
  mod_http2-1.15.7-8.module_el8.8.0+3554+ec1058a7.3.x86_64
  openldap-devel-2.4.46-18.el8.x86_64

完了しました!

確認

dnf list installed | grep httpd
[root@SV-ALTAIR ~]# dnf list installed | grep httpd
almalinux-logos-httpd.noarch                84.5-1.el8                               @appstream
httpd.x86_64                                2.4.37-56.module_el8.8.0+3560+c8e5e57e.6 @appstream
httpd-devel.x86_64                          2.4.37-56.module_el8.8.0+3560+c8e5e57e.6 @appstream
httpd-filesystem.noarch                     2.4.37-56.module_el8.8.0+3560+c8e5e57e.6 @appstream
httpd-manual.noarch                         2.4.37-56.module_el8.8.0+3560+c8e5e57e.6 @appstream
httpd-tools.x86_64                          2.4.37-56.module_el8.8.0+3560+c8e5e57e.6 @appstream
which httpd
[root@SV-ALTAIR ~]# which httpd
/usr/sbin/httpd

httpd起動

systemctl start httpd
systemctl status httpd
[root@SV-ALTAIR ~]# systemctl start httpd
[root@SV-ALTAIR ~]# systemctl status httpd
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
   Active: active (running) since Sun 2023-06-25 23:52:53 JST; 4s ago
     Docs: man:httpd.service(8)
 Main PID: 656089 (httpd)
   Status: "Started, listening on: port 80"
    Tasks: 213 (limit: 12340)
   Memory: 26.2M
   CGroup: /system.slice/httpd.service
           tq656089 /usr/sbin/httpd -DFOREGROUND
           tq656090 /usr/sbin/httpd -DFOREGROUND
           tq656091 /usr/sbin/httpd -DFOREGROUND
           tq656092 /usr/sbin/httpd -DFOREGROUND
           mq656093 /usr/sbin/httpd -DFOREGROUND

 625 23:52:53 SV-ALTAIR systemd[1]: Starting The Apache HTTP Server...
 625 23:52:53 SV-ALTAIR httpd[656089]: AH00558: httpd: Could not reliably determine the server's>
 6月 25 23:52:53 SV-ALTAIR systemd[1]: Started The Apache HTTP Server.
 6月 25 23:52:53 SV-ALTAIR httpd[656089]: Server configured, listening on: port 80
ps -aux | grep httpd
[root@SV-ALTAIR ~]# ps -aux | grep httpd
root      656089  0.1  0.5 265100 11372 ?        Ss   23:52   0:00 /usr/sbin/httpd -DFOREGROUND
apache    656090  0.0  0.4 269784  8436 ?        S    23:52   0:00 /usr/sbin/httpd -DFOREGROUND
apache    656091  0.0  0.5 1327568 10112 ?       Sl   23:52   0:00 /usr/sbin/httpd -DFOREGROUND
apache    656092  0.0  0.7 1458696 14204 ?       Sl   23:52   0:00 /usr/sbin/httpd -DFOREGROUND
apache    656093  0.0  0.5 1327568 10112 ?       Sl   23:52   0:00 /usr/sbin/httpd -DFOREGROUND
root      656308  0.0  0.0 221944  1180 pts/0    R+   23:53   0:00 grep --color=auto httpd

手順④ 自動起動の設定

systemctl enable httpd
systemctl is-enabled httpd
[root@SV-ALTAIR ~]# systemctl enable httpd
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
[root@SV-ALTAIR ~]# systemctl is-enabled httpd
enabled

手順⑤ firewallにhttp (TCP 80) の追加

firewall-cmd --zone=public --add-service=http --permanent
firewall-cmd --reload
[root@SV-ALTAIR ~]# firewall-cmd --zone=public --add-service=http --permanent
success
[root@SV-ALTAIR ~]# firewall-cmd --reload
success

手順⑥ 動作確認

ブラウザChromeのアドレスバーにサーバー名を入れて、表示確認します。

手順⑦ confの設定変更

/etc/httpd/conf

元のファイルを念のためにバックアップしてから編集します。

cp -p httpd.conf httpd.conf_originalbk
vi httpd.conf

実行ユーザー

     62 # If you wish httpd to run as a different user or group, you must run
     63 # httpd as root initially and it will switch.
     64 #
     65 # User/Group: The name (or #number) of the user/group to run httpd as.
     66 # It is usually good practice to create a dedicated user and group for
     67 # running httpd, as with most system services.
     68 #
     69 User www   ←★★変更
     70 Group www   ←★★変更

メールアドレス

     85 # ServerAdmin: Your address, where problems with the server should be
     86 # e-mailed.  This address appears on some server-generated pages, such
     87 # as error documents.  e.g. admin@your-domain.com
     88 #
     89 ServerAdmin webmaster@space.com   ←★★変更

サーバー名

     92 # ServerName gives the name and port that the server uses to identify itself.
     93 # This can often be determined automatically, but we recommend you specify
     94 # it explicitly to prevent problems during startup.
     95 #
     96 # If your host doesn't have a registered DNS name, enter its IP address here.
     97 #
     98 ServerName sv-altair.planet.space.com:80   ←★★変更

ドキュメントルート

    118 # DocumentRoot: The directory out of which you will serve your
    119 # documents. By default, all requests are taken from this directory, but
    120 # symbolic links and aliases may be used to point to other locations.
    121 #
    122 DocumentRoot "/home/www/html"   ←★★変更
    125 # Relax access to content within /var/www.
    126 #
    127 <Directory "/home/www">   ←★★変更
    128     AllowOverride None
    129     # Allow open access:
    130     Require all granted
    131 </Directory>
    133 # Further relax access to the default document root:
    134 <Directory "/home/www/html">   ←★★変更
    135     #
    136     # Possible values for the Options directive are "None", "All",
    137     # or any combination of:
    138     #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    139     #
    140     # Note that "MultiViews" must be named *explicitly* --- "Options All"
    141     # doesn't give it to you.
    142     #
    143     # The Options directive is both complicated and important.  Please see
    144     # http://httpd.apache.org/docs/2.4/mod/core.html#options
    145     # for more information.
    146     #
    147     Options FollowSymLinks   ←★★変更
    243     # ScriptAlias: This controls which directories contain server scripts.
    244     # ScriptAliases are essentially the same as Aliases, except that
    245     # documents in the target directory are treated as applications and
    246     # run by the server when requested rather than as documents sent to the
    247     # client.  The same rules about trailing "/" apply to ScriptAlias
    248     # directives as to Alias.
    249     #
    250     ScriptAlias /cgi-bin/ "/home/www/cgi-bin/"   ←★★変更
    255 # "/var/www/cgi-bin" should be changed to whatever your ScriptAliased
    256 # CGI directory exists, if you have that configured.
    257 #
    258 <Directory "/home/www/cgi-bin">   ←★★変更
    259     AllowOverride None
    260     Options None
    261     Require all granted
    262 </Directory>

確認

httpd -t
[root@SV-ALTAIR conf]# httpd -t
AH00526: Syntax error on line 122 of /etc/httpd/conf/httpd.conf:
DocumentRoot '/home/www/html' is not a directory, or is not readable

手順⑧ ディレクトリ作成

ドキュメントルート用のディレクトリ作成

cd /home/www
mkdir html
mkdir cgi-bin
chown www:www html
chown www:www cgi-bin
[root@SV-ALTAIR www]# ll
合計 0
drwxr-xr-x 2 www www 6  626 00:08 cgi-bin
drwxr-xr-x 2 www www 6  626 00:07 html

確認

httpd -t
[root@SV-ALTAIR www]# httpd -t
Syntax OK

手順⑨ 使用しないファイルのリネーム

下記2ファイルは使用しないのでリネームしておきます。

/etc/httpd/conf.d/autoindex.conf
/etc/httpd/conf.d/welcome.conf
[root@SV-ALTAIR www]# cd /etc/httpd/conf.d
[root@SV-ALTAIR conf.d]# ls
README  autoindex.conf  manual.conf  userdir.conf  welcome.conf
[root@SV-ALTAIR conf.d]# mv autoindex.conf autoindex.conf_originalbk
[root@SV-ALTAIR conf.d]# mv welcome.conf welcome.conf_originalbk
[root@SV-ALTAIR conf.d]# ls
README  autoindex.conf_originalbk  manual.conf  userdir.conf  welcome.conf_originalbk

手順⑩ httpd再起動して変更を反映

systemctl restart httpd
systemctl status httpd
[root@SV-ALTAIR conf.d]# systemctl restart httpd
[root@SV-ALTAIR conf.d]# systemctl status httpd
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2023-06-26 00:09:57 JST; 9s ago
     Docs: man:httpd.service(8)
 Main PID: 656431 (httpd)
   Status: "Running, listening on: port 80"
    Tasks: 213 (limit: 12340)
   Memory: 24.8M
   CGroup: /system.slice/httpd.service
           tq656431 /usr/sbin/httpd -DFOREGROUND
           tq656433 /usr/sbin/httpd -DFOREGROUND
           tq656434 /usr/sbin/httpd -DFOREGROUND
           tq656435 /usr/sbin/httpd -DFOREGROUND
           mq656436 /usr/sbin/httpd -DFOREGROUND

 626 00:09:57 SV-ALTAIR systemd[1]: httpd.service: Succeeded.
 626 00:09:57 SV-ALTAIR systemd[1]: Stopped The Apache HTTP Server.
 626 00:09:57 SV-ALTAIR systemd[1]: Starting The Apache HTTP Server...
 626 00:09:57 SV-ALTAIR systemd[1]: Started The Apache HTTP Server.
 626 00:09:57 SV-ALTAIR httpd[656431]: Server configured, listening on: port 80

手順⑪ テストページの表示確認

cd /home/www/html
vi index.html
chown www:www index.html
[root@SV-ALTAIR conf.d]# cd /home/www/html
[root@SV-ALTAIR html]# vi index.html
[root@SV-ALTAIR html]# chown www:www index.html
[root@SV-ALTAIR html]# ls -l
合計 4
-rw-r--r-- 1 www www 10  626 00:11 index.html