そういうのがいいブログ

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

CentOS8のApache2.4.37インストール手順【コマンド付き丁寧解説】

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

CentOS8のApache2.4.37インストール手順


CentOS8のApache2.4.37インストール手順をコマンド付きで丁寧に解説します

CentOSLAMP環境を構築したいけれど、詳しい手順が分からない、と悩んでいませんか?

前回の記事でCentOS8の基本設定ができたので、次はウェブサーバ「Apache」をインストールして、
ウェブページが表示できるようにするまでの手順を、コマンド付きで丁寧に紹介します。

あと、後半では、インフラエンジニアになるためにおすすめの勉強法があれば知りたい、と考えているかたへのおススメ勉強法も書きます。

Apache」をインストールして、ウェブページが表示できるようにするまでの手順を解説します。
コマンドを真似しながら進めれば、1時間弱くらいで簡単にできます。

本記事では、下記の内容を解説します。

  • CentOS8にApache2.4 をインストールする手順
  • Apacheインストール後の設定(httpd.confの編集)
  • テスト用index.htmlの作成、ブラウザでの表示
  • インフラエンジニアになるためのおススメの勉強法の紹介

この記事を書いている私は、某SIerに勤務しながら、WEB系エンジニア・インフラエンジニアに憧れて、
プログラミングおよびインフラ技術の勉強をしています。
私が実機で試したコマンドや画像を載せて書いていますので、記事の信頼性担保に繋がると思います。

前提条件

前回の記事でやったCentOS8のインストール後の基本設定と、
ファイアウォールの設定までが完了している状態からスタートです。

souiunogaii.hatenablog.com
souiunogaii.hatenablog.com

CentOSのバージョン確認

cat /etc/redhat-release

[root@SV-NEPTUNE ~]# cat /etc/redhat-release
CentOS Linux release 8.0.1905 (Core) 

Apache専用ユーザー「www」作成・パスワード変更

ユーザー作成

useradd -s /sbin/nologin www

[root@SV-NEPTUNE ~]# useradd -s /sbin/nologin www
[root@SV-NEPTUNE ~]# 

パスワード変更

passwd www

[root@SV-NEPTUNE ~]# passwd www
ユーザー www のパスワードを変更。
新しいパスワード:
新しいパスワードを再入力してください:
passwd: すべての認証トークンが正しく更新できました。

作成したユーザ情報の確認

cat /etc/passwd | grep www

[root@SV-NEPTUNE ~]# cat /etc/passwd | grep www
www:x:1001:1001::/home/www:/sbin/nologin

id www

[root@SV-NEPTUNE ~]# id www
uid=1001(www) gid=1001(www) groups=1001(www)

Apacheのパッケージ「httpd」の確認

httpdパッケージ一覧の表示

dnf list | grep httpd

[root@SV-NEPTUNE ~]# dnf list | grep httpd
centos-logos-httpd.noarch                            80.5-2.el8                                              AppStream 
httpd.x86_64                                         2.4.37-12.module_el8.0.0+185+5908b0db                   AppStream 
httpd-devel.x86_64                                   2.4.37-12.module_el8.0.0+185+5908b0db                   AppStream 
httpd-filesystem.noarch                              2.4.37-12.module_el8.0.0+185+5908b0db                   AppStream 
httpd-manual.noarch                                  2.4.37-12.module_el8.0.0+185+5908b0db                   AppStream 
httpd-tools.x86_64                                   2.4.37-12.module_el8.0.0+185+5908b0db                   AppStream 
keycloak-httpd-client-install.noarch                 0.8-7.el8                                               AppStream 
libmicrohttpd.i686                                   1:0.9.59-2.el8                                          BaseOS    
libmicrohttpd.x86_64                                 1:0.9.59-2.el8                                          BaseOS    
python3-keycloak-httpd-client-install.noarch         0.8-7.el8                                               AppStream 

インストールするパッケージは4個

Apacheのパッケージ「httpd」のインストール

dnf install httpd httpd-tools httpd-devel httpd-manual

[root@SV-NEPTUNE ~]# dnf install httpd httpd-tools httpd-devel httpd-manual
CentOS-8 - AppStream     [===                 ] ---  B/s |   0  B     --:-- ETACentOS-8 - AppStream     [===                 ] ---  B/s |   0  B     --:-- ETACentOS-8 - AppStream     [   ===              ] ---  B/s |   0  B     --:-- ETACentOS-8 - AppStream                            2.0 kB/s | 4.3 kB     00:02    
CentOS-8 - Base          [      ===           ] ---  B/s |   0  B     --:-- ETACentOS-8 - Base          [         ===        ] ---  B/s |   0  B     --:-- ETACentOS-8 - Base          [            ===     ] ---  B/s |   0  B     --:-- ETACentOS-8 - Base                                 1.7 kB/s | 3.9 kB     00:02    
CentOS-8 - Extras        [               ===  ] ---  B/s |   0  B     --:-- ETACentOS-8 - Extras        [===                 ] ---  B/s |   0  B     --:-- ETACentOS-8 - Extras        [===                 ] ---  B/s |   0  B     --:-- ETACentOS-8 - Extras        [   ===              ] ---  B/s |   0  B     --:-- ETACentOS-8 - Extras                               623  B/s | 1.5 kB     00:02    
依存関係が解決しました。
================================================================================
 パッケージ        アーキテクチャー
                          バージョン                            リポジトリ
                                                                          サイズ
================================================================================
Installing:
 httpd             x86_64 2.4.37-12.module_el8.0.0+185+5908b0db AppStream 1.7 M
 httpd-devel       x86_64 2.4.37-12.module_el8.0.0+185+5908b0db AppStream 216 k
 httpd-manual      noarch 2.4.37-12.module_el8.0.0+185+5908b0db AppStream 2.4 M
 httpd-tools       x86_64 2.4.37-12.module_el8.0.0+185+5908b0db AppStream 102 k
依存関係をインストール中:
 apr               x86_64 1.6.3-9.el8                           AppStream 125 k
 apr-devel         x86_64 1.6.3-9.el8                           AppStream 246 k
 apr-util          x86_64 1.6.1-6.el8                           AppStream 105 k
 apr-util-devel    x86_64 1.6.1-6.el8                           AppStream  86 k
 centos-logos-httpd
                   noarch 80.5-2.el8                            AppStream  24 k
 httpd-filesystem  noarch 2.4.37-12.module_el8.0.0+185+5908b0db AppStream  35 k
 libdb-devel       x86_64 5.3.28-36.el8                         AppStream  46 k
 mod_http2         x86_64 1.11.3-3.module_el8.0.0+185+5908b0db  AppStream 158 k
 cyrus-sasl        x86_64 2.1.27-0.3rc7.el8                     BaseOS     96 k
 cyrus-sasl-devel  x86_64 2.1.27-0.3rc7.el8                     BaseOS    127 k
 expat-devel       x86_64 2.2.5-3.el8                           BaseOS     55 k
 openldap-devel    x86_64 2.4.46-9.el8                          BaseOS    810 k
弱い依存関係をインストール中:
 apr-util-bdb      x86_64 1.6.1-6.el8                           AppStream  25 k
 apr-util-openssl  x86_64 1.6.1-6.el8                           AppStream  27 k
Enabling module streams:
 httpd                    2.4                                                  

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

ダウンロードサイズの合計: 6.3 M
インストール済みのサイズ: 20 M
これでよろしいですか? [y/N]: y
パッケージのダウンロード中です:
CentOS-8 - AppStream     [      ===           ] ---  B/s |   0  B     --:-- ETACentOS-8 - AppStream     [         ===        ] ---  B/s |   0  B     --:-- ETACentOS-8 - AppStream     [            ===     ] 567  B/s | 670  B     --:-- ETA(1/18): apr-1.6.3-9.  0% [                    ] ---  B/s |   0  B     --:-- ETA(1/18): apr-util-1.6.1-6.el8.x86_64.rpm         730 kB/s | 105 kB     00:00    
(2-3/18): apr-devel-  6% [=                   ] 2.9 MB/s | 427 kB     00:02 ETA(2/18): apr-devel-1.6.3-9.el8.x86_64.rpm        1.5 MB/s | 246 kB     00:00    
(3-4/18): apr-util-b  6% [=                   ] 2.9 MB/s | 445 kB     00:02 ETA(3/18): apr-1.6.3-9.el8.x86_64.rpm              760 kB/s | 125 kB     00:00    
(4-5/18): apr-util-d  7% [=                   ] 2.9 MB/s | 476 kB     00:02 ETA(4/18): apr-util-bdb-1.6.1-6.el8.x86_64.rpm     747 kB/s |  25 kB     00:00    
(5-6/18): apr-util-o  7% [=-                  ] 2.9 MB/s | 501 kB     00:02 ETA(5/18): apr-util-openssl-1.6.1-6.el8.x86_64.rpm 1.1 MB/s |  27 kB     00:00    
(6-7/18): centos-log  9% [=-                  ] 2.9 MB/s | 605 kB     00:01 ETA(6/18): apr-util-devel-1.6.1-6.el8.x86_64.rpm   1.9 MB/s |  86 kB     00:00    
(7-8/18): httpd-2.4.  9% [=-                  ] 2.9 MB/s | 613 kB     00:01 ETA(7/18): centos-logos-httpd-80.5-2.el8.noarch.rp 549 kB/s |  24 kB     00:00    
(8-9/18): httpd-deve  9% [=-                  ] 2.9 MB/s | 637 kB     00:01 ETA(8/18): httpd-2.4.37-12.module_el8.0.0+185+5908 5.6 MB/s | 1.7 MB     00:00    
(9-10/18): httpd-fil 39% [=======-            ] 3.1 MB/s | 2.5 MB     00:01 ETA(9/18): httpd-devel-2.4.37-12.module_el8.0.0+18 630 kB/s | 216 kB     00:00    
(10-11/18): httpd-ma 45% [=========           ] 3.1 MB/s | 2.8 MB     00:01 ETA(10/18): httpd-filesystem-2.4.37-12.module_el8. 102 kB/s |  35 kB     00:00    
(11-12/18): httpd-to 47% [=========-          ] 3.1 MB/s | 3.0 MB     00:01 ETA(11/18): libdb-devel-5.3.28-36.el8.x86_64.rpm   399 kB/s |  46 kB     00:00    
(12-13/18): httpd-to 65% [=============       ] 3.3 MB/s | 4.1 MB     00:00 ETA(12/18): httpd-manual-2.4.37-12.module_el8.0.0+ 8.0 MB/s | 2.4 MB     00:00    
(13-14/18): mod_http 81% [================    ] 3.4 MB/s | 5.1 MB     00:00 ETA(13/18): httpd-tools-2.4.37-12.module_el8.0.0+1 428 kB/s | 102 kB     00:00    
(14-15/18): cyrus-sa 81% [================    ] 3.4 MB/s | 5.1 MB     00:00 ETA(14/18): cyrus-sasl-2.1.27-0.3rc7.el8.x86_64.rp 1.1 MB/s |  96 kB     00:00    
(15-16/18): cyrus-sa 85% [=================   ] 3.4 MB/s | 5.4 MB     00:00 ETA(15/18): cyrus-sasl-devel-2.1.27-0.3rc7.el8.x86 1.2 MB/s | 127 kB     00:00    
(16-17/18): mod_http 86% [=================   ] 3.4 MB/s | 5.4 MB     00:00 ETA(16/18): expat-devel-2.2.5-3.el8.x86_64.rpm     2.6 MB/s |  55 kB     00:00    
(17-18/18): mod_http 87% [=================   ] 3.4 MB/s | 5.5 MB     00:00 ETA(17/18): mod_http2-1.11.3-3.module_el8.0.0+185+ 696 kB/s | 158 kB     00:00    
(18/18): openldap-de 87% [=================-  ] 3.4 MB/s | 5.5 MB     00:00 ETA(18/18): openldap-devel-2.4.46-9.el8.x86_64.rpm 6.7 MB/s | 810 kB     00:00    
--------------------------------------------------------------------------------
合計                                            1.9 MB/s | 6.3 MB     00:03     
トランザクションの確認を実行中
トランザクションの確認に成功しました。
トランザクションのテストを実行中
トランザクションのテストに成功しました。
トランザクションを実行中
  準備             :  [==                                                 ] 1/1  準備             :  [=====                                              ] 1/1  準備             :  [========                                           ] 1/1  準備             :  [===========                                        ] 1/1  準備             :  [=============                                      ] 1/1  準備             :  [================                                   ] 1/1  準備             :  [===================                                ] 1/1  準備             :  [======================                             ] 1/1  準備             :  [=========================                          ] 1/1  準備             :  [============================                       ] 1/1  準備             :  [===============================                    ] 1/1  準備             :  [=================================                  ] 1/1  準備             :  [====================================               ] 1/1  準備             :  [=======================================            ] 1/1  準備             :  [==========================================         ] 1/1  準備             :  [============================================       ] 1/1  準備             :  [===============================================    ] 1/1  準備             :                                                        1/1 
  Installing       : apr-1.6.3-9.el8.x86_64 [                           ]  1/18  Installing       : apr-1.6.3-9.el8.x86_64 [==                         ]  1/18  Installing       : apr-1.6.3-9.el8.x86_64 [=====                      ]  1/18  Installing       : apr-1.6.3-9.el8.x86_64 [========                   ]  1/18  Installing       : apr-1.6.3-9.el8.x86_64 [===========                ]  1/18  Installing       : apr-1.6.3-9.el8.x86_64 [==============             ]  1/18  Installing       : apr-1.6.3-9.el8.x86_64 [=================          ]  1/18  Installing       : apr-1.6.3-9.el8.x86_64 [====================       ]  1/18  Installing       : apr-1.6.3-9.el8.x86_64 [=======================    ]  1/18  Installing       : apr-1.6.3-9.el8.x86_64 [========================   ]  1/18  Installing       : apr-1.6.3-9.el8.x86_64 [=========================  ]  1/18  Installing       : apr-1.6.3-9.el8.x86_64 [========================== ]  1/18  Installing       : apr-1.6.3-9.el8.x86_64                                1/18 
  scriptletの実行中: apr-1.6.3-9.el8.x86_64                                1/18 
  Installing       : apr-util-bdb-1.6.1-6.el8 [                         ]  2/18  Installing       : apr-util-bdb-1.6.1-6.el8 [======================== ]  2/18  Installing       : apr-util-bdb-1.6.1-6.el8.x86_64                       2/18 
  Installing       : apr-util-openssl-1.6.1-6 [                         ]  3/18  Installing       : apr-util-openssl-1.6.1-6 [======================== ]  3/18  Installing       : apr-util-openssl-1.6.1-6.el8.x86_64                   3/18 
  Installing       : apr-util-1.6.1-6.el8.x86 [                         ]  4/18  Installing       : apr-util-1.6.1-6.el8.x86 [===                      ]  4/18  Installing       : apr-util-1.6.1-6.el8.x86 [======                   ]  4/18  Installing       : apr-util-1.6.1-6.el8.x86 [==========               ]  4/18  Installing       : apr-util-1.6.1-6.el8.x86 [=============            ]  4/18  Installing       : apr-util-1.6.1-6.el8.x86 [=================        ]  4/18  Installing       : apr-util-1.6.1-6.el8.x86 [====================     ]  4/18  Installing       : apr-util-1.6.1-6.el8.x86 [======================   ]  4/18  Installing       : apr-util-1.6.1-6.el8.x86 [======================== ]  4/18  Installing       : apr-util-1.6.1-6.el8.x86_64                           4/18 
  scriptletの実行中: apr-util-1.6.1-6.el8.x86_64                           4/18 
  Installing       : apr-devel-1.6.3-9.el8.x8 [                         ]  5/18  Installing       : apr-devel-1.6.3-9.el8.x8 [=                        ]  5/18  Installing       : apr-devel-1.6.3-9.el8.x8 [==                       ]  5/18  Installing       : apr-devel-1.6.3-9.el8.x8 [===                      ]  5/18  Installing       : apr-devel-1.6.3-9.el8.x8 [====                     ]  5/18  Installing       : apr-devel-1.6.3-9.el8.x8 [=====                    ]  5/18  Installing       : apr-devel-1.6.3-9.el8.x8 [======                   ]  5/18  Installing       : apr-devel-1.6.3-9.el8.x8 [=======                  ]  5/18  Installing       : apr-devel-1.6.3-9.el8.x8 [========                 ]  5/18  Installing       : apr-devel-1.6.3-9.el8.x8 [=========                ]  5/18  Installing       : apr-devel-1.6.3-9.el8.x8 [==========               ]  5/18  Installing       : apr-devel-1.6.3-9.el8.x8 [===========              ]  5/18  Installing       : apr-devel-1.6.3-9.el8.x8 [============             ]  5/18  Installing       : apr-devel-1.6.3-9.el8.x8 [=============            ]  5/18  Installing       : apr-devel-1.6.3-9.el8.x8 [==============           ]  5/18  Installing       : apr-devel-1.6.3-9.el8.x8 [===============          ]  5/18  Installing       : apr-devel-1.6.3-9.el8.x8 [================         ]  5/18  Installing       : apr-devel-1.6.3-9.el8.x8 [=================        ]  5/18  Installing       : apr-devel-1.6.3-9.el8.x8 [==================       ]  5/18  Installing       : apr-devel-1.6.3-9.el8.x8 [===================      ]  5/18  Installing       : apr-devel-1.6.3-9.el8.x8 [====================     ]  5/18  Installing       : apr-devel-1.6.3-9.el8.x8 [=====================    ]  5/18  Installing       : apr-devel-1.6.3-9.el8.x8 [======================   ]  5/18  Installing       : apr-devel-1.6.3-9.el8.x8 [=======================  ]  5/18  Installing       : apr-devel-1.6.3-9.el8.x8 [======================== ]  5/18  Installing       : apr-devel-1.6.3-9.el8.x86_64                          5/18 
  Installing       : httpd-tools-2.4.37-12.mo [                         ]  6/18  Installing       : httpd-tools-2.4.37-12.mo [====                     ]  6/18  Installing       : httpd-tools-2.4.37-12.mo [=======                  ]  6/18  Installing       : httpd-tools-2.4.37-12.mo [==========               ]  6/18  Installing       : httpd-tools-2.4.37-12.mo [============             ]  6/18  Installing       : httpd-tools-2.4.37-12.mo [===============          ]  6/18  Installing       : httpd-tools-2.4.37-12.mo [=================        ]  6/18  Installing       : httpd-tools-2.4.37-12.mo [===================      ]  6/18  Installing       : httpd-tools-2.4.37-12.mo [====================     ]  6/18  Installing       : httpd-tools-2.4.37-12.mo [=======================  ]  6/18  Installing       : httpd-tools-2.4.37-12.mo [======================== ]  6/18  Installing       : httpd-tools-2.4.37-12.module_el8.0.0+185+5908b0db.    6/18 
  Installing       : expat-devel-2.2.5-3.el8. [                         ]  7/18  Installing       : expat-devel-2.2.5-3.el8. [=====                    ]  7/18  Installing       : expat-devel-2.2.5-3.el8. [======                   ]  7/18  Installing       : expat-devel-2.2.5-3.el8. [=======                  ]  7/18  Installing       : expat-devel-2.2.5-3.el8. [========                 ]  7/18  Installing       : expat-devel-2.2.5-3.el8. [=========                ]  7/18  Installing       : expat-devel-2.2.5-3.el8. [==============           ]  7/18  Installing       : expat-devel-2.2.5-3.el8. [===================      ]  7/18  Installing       : expat-devel-2.2.5-3.el8. [======================== ]  7/18  Installing       : expat-devel-2.2.5-3.el8.x86_64                        7/18 
  scriptletの実行中: cyrus-sasl-2.1.27-0.3rc7.el8.x86_64                   8/18 
  Installing       : cyrus-sasl-2.1.27-0.3rc7 [                         ]  8/18  Installing       : cyrus-sasl-2.1.27-0.3rc7 [===                      ]  8/18  Installing       : cyrus-sasl-2.1.27-0.3rc7 [========                 ]  8/18  Installing       : cyrus-sasl-2.1.27-0.3rc7 [=============            ]  8/18  Installing       : cyrus-sasl-2.1.27-0.3rc7 [==================       ]  8/18  Installing       : cyrus-sasl-2.1.27-0.3rc7 [===================      ]  8/18  Installing       : cyrus-sasl-2.1.27-0.3rc7 [======================   ]  8/18  Installing       : cyrus-sasl-2.1.27-0.3rc7 [=======================  ]  8/18  Installing       : cyrus-sasl-2.1.27-0.3rc7 [======================== ]  8/18  Installing       : cyrus-sasl-2.1.27-0.3rc7.el8.x86_64                   8/18 
  scriptletの実行中: cyrus-sasl-2.1.27-0.3rc7.el8.x86_64                   8/18 
  Installing       : cyrus-sasl-devel-2.1.27- [                         ]  9/18  Installing       : cyrus-sasl-devel-2.1.27- [==                       ]  9/18  Installing       : cyrus-sasl-devel-2.1.27- [=====                    ]  9/18  Installing       : cyrus-sasl-devel-2.1.27- [======                   ]  9/18  Installing       : cyrus-sasl-devel-2.1.27- [==========               ]  9/18  Installing       : cyrus-sasl-devel-2.1.27- [============             ]  9/18  Installing       : cyrus-sasl-devel-2.1.27- [================         ]  9/18  Installing       : cyrus-sasl-devel-2.1.27- [=================        ]  9/18  Installing       : cyrus-sasl-devel-2.1.27- [==================       ]  9/18  Installing       : cyrus-sasl-devel-2.1.27- [===================      ]  9/18  Installing       : cyrus-sasl-devel-2.1.27- [====================     ]  9/18  Installing       : cyrus-sasl-devel-2.1.27- [=====================    ]  9/18  Installing       : cyrus-sasl-devel-2.1.27- [======================   ]  9/18  Installing       : cyrus-sasl-devel-2.1.27- [=======================  ]  9/18  Installing       : cyrus-sasl-devel-2.1.27- [======================== ]  9/18  Installing       : cyrus-sasl-devel-2.1.27-0.3rc7.el8.x86_64             9/18 
  Installing       : openldap-devel-2.4.46-9. [                         ] 10/18  Installing       : openldap-devel-2.4.46-9. [=                        ] 10/18  Installing       : openldap-devel-2.4.46-9. [==                       ] 10/18  Installing       : openldap-devel-2.4.46-9. [===                      ] 10/18  Installing       : openldap-devel-2.4.46-9. [====                     ] 10/18  Installing       : openldap-devel-2.4.46-9. [=====                    ] 10/18  Installing       : openldap-devel-2.4.46-9. [======                   ] 10/18  Installing       : openldap-devel-2.4.46-9. [=======                  ] 10/18  Installing       : openldap-devel-2.4.46-9. [========                 ] 10/18  Installing       : openldap-devel-2.4.46-9. [=========                ] 10/18  Installing       : openldap-devel-2.4.46-9. [==========               ] 10/18  Installing       : openldap-devel-2.4.46-9. [===========              ] 10/18  Installing       : openldap-devel-2.4.46-9. [============             ] 10/18  Installing       : openldap-devel-2.4.46-9. [=============            ] 10/18  Installing       : openldap-devel-2.4.46-9. [==============           ] 10/18  Installing       : openldap-devel-2.4.46-9. [===============          ] 10/18  Installing       : openldap-devel-2.4.46-9. [================         ] 10/18  Installing       : openldap-devel-2.4.46-9. [=================        ] 10/18  Installing       : openldap-devel-2.4.46-9. [==================       ] 10/18  Installing       : openldap-devel-2.4.46-9. [===================      ] 10/18  Installing       : openldap-devel-2.4.46-9. [====================     ] 10/18  Installing       : openldap-devel-2.4.46-9. [=====================    ] 10/18  Installing       : openldap-devel-2.4.46-9. [======================   ] 10/18  Installing       : openldap-devel-2.4.46-9. [=======================  ] 10/18  Installing       : openldap-devel-2.4.46-9. [======================== ] 10/18  Installing       : openldap-devel-2.4.46-9.el8.x86_64                   10/18 
  Installing       : libdb-devel-5.3.28-36.el [                         ] 11/18  Installing       : libdb-devel-5.3.28-36.el [======                   ] 11/18  Installing       : libdb-devel-5.3.28-36.el [============             ] 11/18  Installing       : libdb-devel-5.3.28-36.el [===================      ] 11/18  Installing       : libdb-devel-5.3.28-36.el [=======================  ] 11/18  Installing       : libdb-devel-5.3.28-36.el [======================== ] 11/18  Installing       : libdb-devel-5.3.28-36.el8.x86_64                     11/18 
  Installing       : apr-util-devel-1.6.1-6.e [                         ] 12/18  Installing       : apr-util-devel-1.6.1-6.e [=                        ] 12/18  Installing       : apr-util-devel-1.6.1-6.e [===                      ] 12/18  Installing       : apr-util-devel-1.6.1-6.e [======                   ] 12/18  Installing       : apr-util-devel-1.6.1-6.e [=======                  ] 12/18  Installing       : apr-util-devel-1.6.1-6.e [=========                ] 12/18  Installing       : apr-util-devel-1.6.1-6.e [==========               ] 12/18  Installing       : apr-util-devel-1.6.1-6.e [===========              ] 12/18  Installing       : apr-util-devel-1.6.1-6.e [============             ] 12/18  Installing       : apr-util-devel-1.6.1-6.e [=============            ] 12/18  Installing       : apr-util-devel-1.6.1-6.e [==============           ] 12/18  Installing       : apr-util-devel-1.6.1-6.e [===============          ] 12/18  Installing       : apr-util-devel-1.6.1-6.e [================         ] 12/18  Installing       : apr-util-devel-1.6.1-6.e [=================        ] 12/18  Installing       : apr-util-devel-1.6.1-6.e [==================       ] 12/18  Installing       : apr-util-devel-1.6.1-6.e [===================      ] 12/18  Installing       : apr-util-devel-1.6.1-6.e [====================     ] 12/18  Installing       : apr-util-devel-1.6.1-6.e [=====================    ] 12/18  Installing       : apr-util-devel-1.6.1-6.e [======================   ] 12/18  Installing       : apr-util-devel-1.6.1-6.e [=======================  ] 12/18  Installing       : apr-util-devel-1.6.1-6.e [======================== ] 12/18  Installing       : apr-util-devel-1.6.1-6.el8.x86_64                    12/18 
  scriptletの実行中: httpd-filesystem-2.4.37-12.module_el8.0.0+185+5908   13/18 
  Installing       : httpd-filesystem-2.4.37- [                         ] 13/18  Installing       : httpd-filesystem-2.4.37- [=                        ] 13/18  Installing       : httpd-filesystem-2.4.37- [===                      ] 13/18  Installing       : httpd-filesystem-2.4.37- [==========               ] 13/18  Installing       : httpd-filesystem-2.4.37- [============             ] 13/18  Installing       : httpd-filesystem-2.4.37- [==============           ] 13/18  Installing       : httpd-filesystem-2.4.37- [================         ] 13/18  Installing       : httpd-filesystem-2.4.37- [==================       ] 13/18  Installing       : httpd-filesystem-2.4.37- [===================      ] 13/18  Installing       : httpd-filesystem-2.4.37- [=====================    ] 13/18  Installing       : httpd-filesystem-2.4.37- [=======================  ] 13/18  Installing       : httpd-filesystem-2.4.37-12.module_el8.0.0+185+5908   13/18 
  Installing       : centos-logos-httpd-80.5- [                         ] 14/18  Installing       : centos-logos-httpd-80.5- [=                        ] 14/18  Installing       : centos-logos-httpd-80.5- [===============          ] 14/18  Installing       : centos-logos-httpd-80.5- [=======================  ] 14/18  Installing       : centos-logos-httpd-80.5-2.el8.noarch                 14/18 
  Installing       : mod_http2-1.11.3-3.modul [                         ] 15/18  Installing       : mod_http2-1.11.3-3.modul [==                       ] 15/18  Installing       : mod_http2-1.11.3-3.modul [===                      ] 15/18  Installing       : mod_http2-1.11.3-3.modul [=====                    ] 15/18  Installing       : mod_http2-1.11.3-3.modul [=======                  ] 15/18  Installing       : mod_http2-1.11.3-3.modul [=========                ] 15/18  Installing       : mod_http2-1.11.3-3.modul [===========              ] 15/18  Installing       : mod_http2-1.11.3-3.modul [=============            ] 15/18  Installing       : mod_http2-1.11.3-3.modul [===============          ] 15/18  Installing       : mod_http2-1.11.3-3.modul [================         ] 15/18  Installing       : mod_http2-1.11.3-3.modul [==================       ] 15/18  Installing       : mod_http2-1.11.3-3.modul [====================     ] 15/18  Installing       : mod_http2-1.11.3-3.modul [======================   ] 15/18  Installing       : mod_http2-1.11.3-3.modul [======================== ] 15/18  Installing       : mod_http2-1.11.3-3.module_el8.0.0+185+5908b0db.x86   15/18 
  Installing       : httpd-2.4.37-12.module_e [                         ] 16/18  Installing       : httpd-2.4.37-12.module_e [=                        ] 16/18  Installing       : httpd-2.4.37-12.module_e [==                       ] 16/18  Installing       : httpd-2.4.37-12.module_e [===                      ] 16/18  Installing       : httpd-2.4.37-12.module_e [====                     ] 16/18  Installing       : httpd-2.4.37-12.module_e [=====                    ] 16/18  Installing       : httpd-2.4.37-12.module_e [======                   ] 16/18  Installing       : httpd-2.4.37-12.module_e [=======                  ] 16/18  Installing       : httpd-2.4.37-12.module_e [========                 ] 16/18  Installing       : httpd-2.4.37-12.module_e [=========                ] 16/18  Installing       : httpd-2.4.37-12.module_e [==========               ] 16/18  Installing       : httpd-2.4.37-12.module_e [===========              ] 16/18  Installing       : httpd-2.4.37-12.module_e [============             ] 16/18  Installing       : httpd-2.4.37-12.module_e [=============            ] 16/18  Installing       : httpd-2.4.37-12.module_e [==============           ] 16/18  Installing       : httpd-2.4.37-12.module_e [===============          ] 16/18  Installing       : httpd-2.4.37-12.module_e [================         ] 16/18  Installing       : httpd-2.4.37-12.module_e [=================        ] 16/18  Installing       : httpd-2.4.37-12.module_e [==================       ] 16/18  Installing       : httpd-2.4.37-12.module_e [===================      ] 16/18  Installing       : httpd-2.4.37-12.module_e [====================     ] 16/18  Installing       : httpd-2.4.37-12.module_e [=====================    ] 16/18  Installing       : httpd-2.4.37-12.module_e [======================   ] 16/18  Installing       : httpd-2.4.37-12.module_e [=======================  ] 16/18  Installing       : httpd-2.4.37-12.module_e [======================== ] 16/18  Installing       : httpd-2.4.37-12.module_el8.0.0+185+5908b0db.x86_64   16/18 
  scriptletの実行中: httpd-2.4.37-12.module_el8.0.0+185+5908b0db.x86_64   16/18 
  Installing       : httpd-devel-2.4.37-12.mo [                         ] 17/18  Installing       : httpd-devel-2.4.37-12.mo [=                        ] 17/18  Installing       : httpd-devel-2.4.37-12.mo [==                       ] 17/18  Installing       : httpd-devel-2.4.37-12.mo [===                      ] 17/18  Installing       : httpd-devel-2.4.37-12.mo [====                     ] 17/18  Installing       : httpd-devel-2.4.37-12.mo [=====                    ] 17/18  Installing       : httpd-devel-2.4.37-12.mo [======                   ] 17/18  Installing       : httpd-devel-2.4.37-12.mo [=======                  ] 17/18  Installing       : httpd-devel-2.4.37-12.mo [========                 ] 17/18  Installing       : httpd-devel-2.4.37-12.mo [=========                ] 17/18  Installing       : httpd-devel-2.4.37-12.mo [==========               ] 17/18  Installing       : httpd-devel-2.4.37-12.mo [===========              ] 17/18  Installing       : httpd-devel-2.4.37-12.mo [============             ] 17/18  Installing       : httpd-devel-2.4.37-12.mo [=============            ] 17/18  Installing       : httpd-devel-2.4.37-12.mo [==============           ] 17/18  Installing       : httpd-devel-2.4.37-12.mo [===============          ] 17/18  Installing       : httpd-devel-2.4.37-12.mo [================         ] 17/18  Installing       : httpd-devel-2.4.37-12.mo [=================        ] 17/18  Installing       : httpd-devel-2.4.37-12.mo [==================       ] 17/18  Installing       : httpd-devel-2.4.37-12.mo [===================      ] 17/18  Installing       : httpd-devel-2.4.37-12.mo [====================     ] 17/18  Installing       : httpd-devel-2.4.37-12.mo [=====================    ] 17/18  Installing       : httpd-devel-2.4.37-12.mo [======================   ] 17/18  Installing       : httpd-devel-2.4.37-12.mo [=======================  ] 17/18  Installing       : httpd-devel-2.4.37-12.mo [======================== ] 17/18  Installing       : httpd-devel-2.4.37-12.module_el8.0.0+185+5908b0db.   17/18 
  Installing       : httpd-manual-2.4.37-12.m [                         ] 18/18  Installing       : httpd-manual-2.4.37-12.m [=                        ] 18/18  Installing       : httpd-manual-2.4.37-12.m [==                       ] 18/18  Installing       : httpd-manual-2.4.37-12.m [===                      ] 18/18  Installing       : httpd-manual-2.4.37-12.m [====                     ] 18/18  Installing       : httpd-manual-2.4.37-12.m [=====                    ] 18/18  Installing       : httpd-manual-2.4.37-12.m [======                   ] 18/18  Installing       : httpd-manual-2.4.37-12.m [=======                  ] 18/18  Installing       : httpd-manual-2.4.37-12.m [========                 ] 18/18  Installing       : httpd-manual-2.4.37-12.m [=========                ] 18/18  Installing       : httpd-manual-2.4.37-12.m [==========               ] 18/18  Installing       : httpd-manual-2.4.37-12.m [===========              ] 18/18  Installing       : httpd-manual-2.4.37-12.m [============             ] 18/18  Installing       : httpd-manual-2.4.37-12.m [=============            ] 18/18  Installing       : httpd-manual-2.4.37-12.m [==============           ] 18/18  Installing       : httpd-manual-2.4.37-12.m [===============          ] 18/18  Installing       : httpd-manual-2.4.37-12.m [================         ] 18/18  Installing       : httpd-manual-2.4.37-12.m [=================        ] 18/18  Installing       : httpd-manual-2.4.37-12.m [==================       ] 18/18  Installing       : httpd-manual-2.4.37-12.m [===================      ] 18/18  Installing       : httpd-manual-2.4.37-12.m [====================     ] 18/18  Installing       : httpd-manual-2.4.37-12.m [=====================    ] 18/18  Installing       : httpd-manual-2.4.37-12.m [======================   ] 18/18  Installing       : httpd-manual-2.4.37-12.m [=======================  ] 18/18  Installing       : httpd-manual-2.4.37-12.m [======================== ] 18/18  Installing       : httpd-manual-2.4.37-12.module_el8.0.0+185+5908b0db   18/18 
  scriptletの実行中: httpd-2.4.37-12.module_el8.0.0+185+5908b0db.x86_64   18/18 
  scriptletの実行中: httpd-manual-2.4.37-12.module_el8.0.0+185+5908b0db   18/18 
  検証             : apr-1.6.3-9.el8.x86_64                                1/18 
  検証             : apr-devel-1.6.3-9.el8.x86_64                          2/18 
  検証             : apr-util-1.6.1-6.el8.x86_64                           3/18 
  検証             : apr-util-bdb-1.6.1-6.el8.x86_64                       4/18 
  検証             : apr-util-devel-1.6.1-6.el8.x86_64                     5/18 
  検証             : apr-util-openssl-1.6.1-6.el8.x86_64                   6/18 
  検証             : centos-logos-httpd-80.5-2.el8.noarch                  7/18 
  検証             : httpd-2.4.37-12.module_el8.0.0+185+5908b0db.x86_64    8/18 
  検証             : httpd-devel-2.4.37-12.module_el8.0.0+185+5908b0db.    9/18 
  検証             : httpd-filesystem-2.4.37-12.module_el8.0.0+185+5908   10/18 
  検証             : httpd-manual-2.4.37-12.module_el8.0.0+185+5908b0db   11/18 
  検証             : httpd-tools-2.4.37-12.module_el8.0.0+185+5908b0db.   12/18 
  検証             : libdb-devel-5.3.28-36.el8.x86_64                     13/18 
  検証             : mod_http2-1.11.3-3.module_el8.0.0+185+5908b0db.x86   14/18 
  検証             : cyrus-sasl-2.1.27-0.3rc7.el8.x86_64                  15/18 
  検証             : cyrus-sasl-devel-2.1.27-0.3rc7.el8.x86_64            16/18 
  検証             : expat-devel-2.2.5-3.el8.x86_64                       17/18 
  検証             : openldap-devel-2.4.46-9.el8.x86_64                   18/18 

インストール済み:
  httpd-2.4.37-12.module_el8.0.0+185+5908b0db.x86_64                            
  httpd-devel-2.4.37-12.module_el8.0.0+185+5908b0db.x86_64                      
  httpd-manual-2.4.37-12.module_el8.0.0+185+5908b0db.noarch                     
  httpd-tools-2.4.37-12.module_el8.0.0+185+5908b0db.x86_64                      
  apr-util-bdb-1.6.1-6.el8.x86_64                                               
  apr-util-openssl-1.6.1-6.el8.x86_64                                           
  apr-1.6.3-9.el8.x86_64                                                        
  apr-devel-1.6.3-9.el8.x86_64                                                  
  apr-util-1.6.1-6.el8.x86_64                                                   
  apr-util-devel-1.6.1-6.el8.x86_64                                             
  centos-logos-httpd-80.5-2.el8.noarch                                          
  httpd-filesystem-2.4.37-12.module_el8.0.0+185+5908b0db.noarch                 
  libdb-devel-5.3.28-36.el8.x86_64                                              
  mod_http2-1.11.3-3.module_el8.0.0+185+5908b0db.x86_64                         
  cyrus-sasl-2.1.27-0.3rc7.el8.x86_64                                           
  cyrus-sasl-devel-2.1.27-0.3rc7.el8.x86_64                                     
  expat-devel-2.2.5-3.el8.x86_64                                                
  openldap-devel-2.4.46-9.el8.x86_64                                            

完了しました!

Apacheのパッケージ「httpd」インストール後の確認

パッケージ一覧の表示

dnf ilist installed | grep httpd

[root@SV-NEPTUNE ~]# dnf ilist installed | grep httpd
centos-logos-httpd.noarch                   80.5-2.el8                                             @AppStream
httpd.x86_64                                2.4.37-12.module_el8.0.0+185+5908b0db                  @AppStream
httpd-devel.x86_64                          2.4.37-12.module_el8.0.0+185+5908b0db                  @AppStream
httpd-filesystem.noarch                     2.4.37-12.module_el8.0.0+185+5908b0db                  @AppStream
httpd-manual.noarch                         2.4.37-12.module_el8.0.0+185+5908b0db                  @AppStream
httpd-tools.x86_64                          2.4.37-12.module_el8.0.0+185+5908b0db                  @AppStream

インストールされたパス確認

which httpd

[root@SV-NEPTUNE ~]# which httpd
/usr/sbin/httpd

httpd起動

起動

systemctl start httpd

[root@SV-NEPTUNE ~]# systemctl start httpd
[root@SV-NEPTUNE ~]# 

ステータス確認

systemctl status httpd

[root@SV-NEPTUNE ~]# systemctl status httpd
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor pres>
   Active: active (running) since Sat 2020-01-04 20:37:54 JST; 15s ago
     Docs: man:httpd.service(8)
 Main PID: 17561 (httpd)
   Status: "Running, listening on: port 80"
    Tasks: 213 (limit: 11141)
   Memory: 25.0M
   CGroup: /system.slice/httpd.service
           tq17561 /usr/sbin/httpd -DFOREGROUND
           tq17562 /usr/sbin/httpd -DFOREGROUND
           tq17563 /usr/sbin/httpd -DFOREGROUND
           tq17564 /usr/sbin/httpd -DFOREGROUND
           mq17565 /usr/sbin/httpd -DFOREGROUND

 104 20:37:54 SV-NEPTUNE systemd[1]: Starting The Apache HTTP Server...
 104 20:37:54 SV-NEPTUNE httpd[17561]: AH00558: httpd: Could not reliably de>
 104 20:37:54 SV-NEPTUNE httpd[17561]: Server configured, listening on: port>
 104 20:37:54 SV-NEPTUNE systemd[1]: Started The Apache HTTP Server.

プロセス確認

ps -aux | grep httpd

[root@SV-NEPTUNE ~]# ps -aux | grep httpd
root     17561  0.0  0.5 280212 11008 ?        Ss   20:37   0:00 /usr/sbin/httpd -DFOREGROUND
apache   17562  0.0  0.4 292428  8392 ?        S    20:37   0:00 /usr/sbin/httpd -DFOREGROUND
apache   17563  0.0  0.6 1350204 11732 ?       Sl   20:37   0:00 /usr/sbin/httpd -DFOREGROUND
apache   17564  0.0  0.7 1481332 13724 ?       Sl   20:37   0:00 /usr/sbin/httpd -DFOREGROUND
apache   17565  0.0  0.6 1350204 11732 ?       Sl   20:37   0:00 /usr/sbin/httpd -DFOREGROUND

自動起動の設定

自動起動設定

systemctl enable httpd

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

自動起動になったか確認

systemctl is-enabled httpd

[root@SV-NEPTUNE ~]# systemctl is-enabled httpd
enabled

ファイアウォールfirewalldの設定

ファイアウォールにhttpサービスを追加

firewall-cmd -a-add-service=http --permanent

[root@SV-NEPTUNE ~]# firewall-cmd -a-add-service=http --permanent
success

firewall-cmd --reload

[root@SV-NEPTUNE ~]# firewall-cmd --reload
success

firewall-cmd --list-all

[root@SV-NEPTUNE ~]# firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: ens192
  sources: 
  services: cockpit dhcpv6-client http
  ports: 
  protocols: 
  masquerade: no
  forward-ports: 
  source-ports: 
  icmp-blocks: 
  rich rules: 

一旦、ブラウザから表示確認

サーバのIPアドレスをブラウザChromeに入力すると、「403エラー」

http://192.168.1.105

httpd.confの編集

httpd.confを編集前にバックアップ

cd /etc/httpd/conf

[root@SV-NEPTUNE ~]# cd /etc/httpd/conf
[root@SV-NEPTUNE conf]# ls -l
合計 28
-rw-r--r-- 1 root root 11899 108 06:40 httpd.conf
-rw-r--r-- 1 root root 13077 108 06:42 magic

cp -p httpd.conf httpd.conf.oriniginal_bk

[root@SV-NEPTUNE conf]# cp -p httpd.conf httpd.conf.oriniginal_bk
[root@SV-NEPTUNE conf]# ls -l
合計 40
-rw-r--r-- 1 root root 11899 108 06:40 httpd.conf
-rw-r--r-- 1 root root 11899 108 06:40 httpd.conf.original_bk
-rw-r--r-- 1 root root 13077 108 06:42 magic

httpd.confの編集

vi httpd.conf

左が編集前 → 右が編集後

00061  |#                                                 ||00061  |#                                                 
00062  |# If you wish httpd to run as a different user or ||00062  |# If you wish httpd to run as a different user or 
00063  |# httpd as root initially and it will switch.     ||00063  |# httpd as root initially and it will switch.     
00064  |#                                                 ||00064  |#                                                 
00065  |# User/Group: The name (or #number) of the user/gr||00065  |# User/Group: The name (or #number) of the user/gr
00066  |# It is usually good practice to create a dedicate||00066  |# It is usually good practice to create a dedicate
00067  |# running httpd, as with most system services.    ||00067  |# running httpd, as with most system services.    
00068  |#                                                 ||00068  |#                                                 
00069 L|User apache                                       ||00069 R|User www                                          
00070 L|Group apache                                      ||00070 R|Group www                                                            
00084  |#                                                 ||00084  |#                                                 
00085  |# ServerAdmin: Your address, where problems with t||00085  |# ServerAdmin: Your address, where problems with t
00086  |# e-mailed.  This address appears on some server-g||00086  |# e-mailed.  This address appears on some server-g
00087  |# as error documents.  e.g. admin@your-domain.com ||00087  |# as error documents.  e.g. admin@your-domain.com 
00088  |#                                                 ||00088  |#                                                 
00089 L|ServerAdmin root@localhost                        ||00089 R|ServerAdmin webadmin@sv-neptune.com               
00091  |#                                                 ||00091  |#                                                 
00092  |# ServerName gives the name and port that the serv||00092  |# ServerName gives the name and port that the serv
00093  |# This can often be determined automatically, but ||00093  |# This can often be determined automatically, but 
00094  |# it explicitly to prevent problems during startup||00094  |# it explicitly to prevent problems during startup
00095  |#                                                 ||00095  |#                                                 
00096  |# If your host doesn't have a registered DNS name,||00096  |# If your host doesn't have a registered DNS name,
00097  |#                                                 ||00097  |#                                                 
00098 L|#ServerName www.example.com:80                    ||00098 R|ServerName www.sv-neptune.com:80                  
00117  |#                                                 ||00117  |#                                                 
00118  |# DocumentRoot: The directory out of which you wil||00118  |# DocumentRoot: The directory out of which you wil
00119  |# documents. By default, all requests are taken fr||00119  |# documents. By default, all requests are taken fr
00120  |# symbolic links and aliases may be used to point ||00120  |# symbolic links and aliases may be used to point 
00121  |#                                                 ||00121  |#                                                 
00122 L|DocumentRoot "/var/www/html"                      ||00122 R|DocumentRoot "/home/www/html"                     
00124  |#                                                 ||00124  |#                                                 
00125  |# Relax access to content within /var/www.        ||00125  |# Relax access to content within /var/www.        
00126  |#                                                 ||00126  |#                                                 
00127 L|<Directory "/var/www">                            ||00127 R|<Directory "/home/www">                           
00128  |    AllowOverride None                            ||00128  |    AllowOverride None                            
00129  |    # Allow open access:                          ||00129  |    # Allow open access:                          
00130  |    Require all granted                           ||00130  |    Require all granted                           
00131  |</Directory>                                      ||00131  |</Directory>                                      
00133  |# Further relax access to the default document roo||00133  |# Further relax access to the default document roo
00134 L|<Directory "/var/www/html">                       ||00134 R|<Directory "/home/www/html">                      
00135  |    #                                             ||00135  |    #                                             
00136  |    # Possible values for the Options directive ar||00136  |    # Possible values for the Options directive ar
00137  |    # or any combination of:                      ||00137  |    # or any combination of:                      
00138  |    #   Indexes Includes FollowSymLinks SymLinksif||00138  |    #   Indexes Includes FollowSymLinks SymLinksif
00139  |    #                                             ||00139  |    #                                             
00140  |    # Note that "MultiViews" must be named *explic||00140  |    # Note that "MultiViews" must be named *explic
00141  |    # doesn't give it to you.                     ||00141  |    # doesn't give it to you.                     
00142  |    #                                             ||00142  |    #                                             
00143  |    # The Options directive is both complicated an||00143  |    # The Options directive is both complicated an
00144  |    # http://httpd.apache.org/docs/2.4/mod/core.ht||00144  |    # http://httpd.apache.org/docs/2.4/mod/core.ht
00145  |    # for more information.                       ||00145  |    # for more information.                       
00146  |    #                                             ||00146  |    #                                             
00147 L|    Options Indexes FollowSymLinks                ||00147 R|    Options FollowSymLinks                        
00242  |    #                                             ||00242  |    #                                             
00243  |    # ScriptAlias: This controls which directories||00243  |    # ScriptAlias: This controls which directories
00244  |    # ScriptAliases are essentially the same as Al||00244  |    # ScriptAliases are essentially the same as Al
00245  |    # documents in the target directory are treate||00245  |    # documents in the target directory are treate
00246  |    # run by the server when requested rather than||00246  |    # run by the server when requested rather than
00247  |    # client.  The same rules about trailing "/" a||00247  |    # client.  The same rules about trailing "/" a
00248  |    # directives as to Alias.                     ||00248  |    # directives as to Alias.                     
00249  |    #                                             ||00249  |    #                                             
00250 L|    ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"     ||00250 R|    ScriptAlias /cgi-bin/ "/home/www/cgi-bin/"    
00254  |#                                                 ||00254  |#                                                 
00255  |# "/var/www/cgi-bin" should be changed to whatever||00255  |# "/var/www/cgi-bin" should be changed to whatever
00256  |# CGI directory exists, if you have that configure||00256  |# CGI directory exists, if you have that configure
00257  |#                                                 ||00257  |#                                                 
00258 L|<Directory "/var/www/cgi-bin">                    ||00258 R|<Directory "/home/www/cgi-bin">                   
00259  |    AllowOverride None                            ||00259  |    AllowOverride None                            
00260  |    Options None                                  ||00260  |    Options None                                  
00261  |    Require all granted                           ||00261  |    Require all granted                           
00262  |</Directory>                                      ||00262  |</Directory>                                      

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

httpd.confファイル編集後のテスト

httpd -t

「/home/www/html」ディレクトリが無いのでエラー

[root@SV-NEPTUNE 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
[root@SV-NEPTUNE conf]# cd /home/www
[root@SV-NEPTUNE www]# mkdir html
[root@SV-NEPTUNE www]# mkdir cgi-bin
[root@SV-NEPTUNE www]# ls -l
合計 0
drwxr-xr-x 2 root root 6  14 21:18 cgi-bin
drwxr-xr-x 2 root root 6  14 21:18 html

アクセス権変更

chown www:www html
chown www:www cgi-bin
[root@SV-NEPTUNE www]# chown www:www html
[root@SV-NEPTUNE www]# chown www:www cgi-bin
[root@SV-NEPTUNE www]# ls -l
合計 0
drwxr-xr-x 2 www www 6  14 21:18 cgi-bin
drwxr-xr-x 2 www www 6  14 21:18 html

再度、httpd.confのテスト

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

不要ファイルのリネーム

cd /etc/httpd/conf.d
[root@SV-NEPTUNE www]# cd /etc/httpd/conf.d
[root@SV-NEPTUNE conf.d]# ls -l
合計 20
-rw-r--r-- 1 root root  400 108 06:44 README
-rw-r--r-- 1 root root 2926 108 06:42 autoindex.conf
-rw-r--r-- 1 root root  344 108 06:40 manual.conf
-rw-r--r-- 1 root root 1252 108 06:40 userdir.conf
-rw-r--r-- 1 root root  516 108 06:40 welcome.conf
mv autoindex.conf autoindex.conf.original_bk
mv welcome.conf welcome.conf.original_bk
[root@SV-NEPTUNE conf.d]# mv autoindex.conf autoindex.conf.original_bk
[root@SV-NEPTUNE conf.d]# mv welcome.conf welcome.conf.original_bk
[root@SV-NEPTUNE conf.d]# ls -l
合計 20
-rw-r--r-- 1 root root  400 108 06:44 README
-rw-r--r-- 1 root root 2926 108 06:42 autoindex.conf.original_bk
-rw-r--r-- 1 root root  344 108 06:40 manual.conf
-rw-r--r-- 1 root root 1252 108 06:40 userdir.conf
-rw-r--r-- 1 root root  516 108 06:40 welcome.conf.original_bk

設定変更後のhttpd再起動

httpd再起動

systemctl restart httpd
[root@SV-NEPTUNE conf.d]# systemctl restart httpd
[root@SV-NEPTUNE conf.d]# 

httpdステータス確認

systemctl status httpd
[root@SV-NEPTUNE conf.d]# systemctl status httpd
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor prese>
   Active: active (running) since Sat 2020-01-04 21:22:52 JST; 12s ago
     Docs: man:httpd.service(8)
 Main PID: 18359 (httpd)
   Status: "Running, listening on: port 80"
    Tasks: 213 (limit: 11141)
   Memory: 24.1M
   CGroup: /system.slice/httpd.service
           tq18359 /usr/sbin/httpd -DFOREGROUND
           tq18361 /usr/sbin/httpd -DFOREGROUND
           tq18362 /usr/sbin/httpd -DFOREGROUND
           tq18363 /usr/sbin/httpd -DFOREGROUND
           mq18364 /usr/sbin/httpd -DFOREGROUND

 104 21:22:52 SV-NEPTUNE systemd[1]: Stopped The Apache HTTP Server.
 104 21:22:52 SV-NEPTUNE systemd[1]: Starting The Apache HTTP Server...
 104 21:22:52 SV-NEPTUNE httpd[18359]: Server configured, listening on: port>
 104 21:22:52 SV-NEPTUNE systemd[1]: Started The Apache HTTP Server.

一旦、ブラウザChromeで表示確認

http://192.168.1.105/

テスト用の「index.html」ファイル作成

cd /home/www/html
vi index.html
[root@SV-NEPTUNE conf.d]# cd /home/www/html
[root@SV-NEPTUNE html]# ls l-l
合計 0
[root@SV-NEPTUNE html]# vi index.html
TEST HTML
chown www:www index.html
[root@SV-NEPTUNE html]# chown www:www index.html


最後にもう一度、ブラウザChromeで表示確認

テスト用の「index.html」ページが表示できた!


参考にしたサイト

www.rem-system.com

インフラエンジニアになるための勉強のやり方

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

現在の会社で直接担当している業務の中では、決まった技術しか触れないけれど、
「他にも将来役に立ちそうなインフラ技術を勉強したい」「働きながらでもできる効率的なインフラエンジニアの勉強方法を知りたい」と考えている方のために、
①おすすめの書籍と、②おススメのオンライン学習サイト、③おすすめのエンジニアスクールを紹介します。

働きながら勉強するための、おススメの書籍と、オンラインで学習できるサイトの紹介です。

インフラエンジニアの勉強ができるおススメ書籍

朝の通勤時や帰宅時の電車の中や、社外打合せへの**移動中などに勉強するなら、やはり書籍が一番**だと思います。

インフラエンジニアの教科書

LINE社に創業時から在籍しているインフラエンジニア・プロマネの「佐野裕」さんの本です。
twitter.com

膨大なトラフィックをさばくLINE社にて構築・保守を行っている現役エンジニアが記すITインフラの必須知識と経験の数々!
サーバ、OS、ネットワーク機器、データセンター、購買と商談、障害対応、大規模インフラ、成長するために必要なスキルなど、基礎知識から実践まで言及。
ITインフラの世界が理解できる珠玉の1冊!

インフラエンジニアの教科書
(C&R研究所)
佐野裕

1週間でLPICの基礎が学べる本

Linuxの資格「LPIC」の試験対策を初心者向けに書いた入門書です。

Linuxの資格として広く知られているLPICですが、あまり知識の無いまま試験対策を始める人も多いのではないでしょうか。しかし、試験対策書は試験範囲についてのみ解説しているものが多く、初心者が理解するのは困難です。本書は、初心者がスムーズに試験対策を行えるよう、事前に基礎固めを行うLinux入門書です。試験情報や模擬問題も掲載しているので、資格取得を視野に入れた効率的な基礎学習が行えます。

1週間でLPICの基礎が学べる本
第3版 徹底攻略シリーズ
(インプレス)
中島能和

インフラエンジニアの勉強ができるオンライン学習サイト

Udemy (オンライン動画学習サイト)

Udemy(ユーデミー)は、オンラインで動画で学習できるサービスです。
ITエンジニア系の講座もたくさん公開されています。

≫Udemy 世界最大級のオンライン学習サイト

Udemyの特徴

  • ユーザー登録すれば、第1回の講座は無料で視聴できる
  • 無料のコンテンツもある
  • 過去に受講した人の人数や、受講した人の評価も表示されるので選びやすい

≫Udemy 世界最大級のオンライン学習サイト


開発の人気オンラインコース


インフラエンジニアの勉強ができる専門スクール

リナックスアカデミー(ITエンジニア専門スクール)

スクールというと、昼間働いている人には難しいかもしれませんが、
以下に紹介するスクールには、
Linuxサーバとネットワークとを両分野ともに学べるコースが、
夜間・土日での5か月~7か月の期間で用意されています。

リナックスアカデミー(ITエンジニア専門スクール) http://www.linuxacademy.ne.jp


リナックスアカデミーの特徴

  • 初心者でも最短4週間でエンジニアになれる「IT教育専門機関」
  • 100%ライブ抗議の「少人数クラス担任制」
  • 実務スキルを身につける「PBL(Project Based Learning)」が充実
  • 圧倒的な合格実績と「合格保証制度」
  • 就職実績と「就職・転職サポート」が充実

リナックスアカデミーが選ばれ続ける最大の理由、それはIT技術に特化した日本初のIT教育専門機関だからということです。他を寄せ付けないカリキュラムと講師の質で日本No.1のオープンソース専門スクールだと認知されています。
スクールとしては世界で初めてLPI(Linux技術者認定機関)プラチナスポンサーに加盟し、LPI-Jアカデミック認定校第一号スクール、OSS-DBアカデミック認定校第一号スクール、PostgreSQL CE認定校、国内唯一のPHP技術者育成認定校Zend Authorized Training Center など、数々の認定を受けています。 先日来日したLPIC資格試験の開発責任者であるMatthew Rice氏にも、「世界でNo.1と言われる日本の市場で、リナックスアカデミーはNo.1のスクールだと言われている。それは素晴らしいことだ」という言葉を頂いています。

リナックスアカデミー(ITエンジニア専門スクール)の資料請求(無料)について詳しく見てみる

以上、読んでいただきありがとうございました。