Apacheの主要な設定をつかさどるhttp.confの設定をやってみる。

まずは保管場所

/etc/httpd/conf/httpd.conf

内容を表示するとこんな感じ。
コメント行だらけなので、基本となるポイントだけ色を変えて整理しながら表示することにした。

#
# This is the main Apache HTTP server configuration file.  It contains the

#

・・・・・・・・・・・・・・・・・・・・・・・・・
最初のコメント群は省略
 ・・・・・・・・・・・・・・・・・・・・・・・・・
#
# ServerRoot: The top of the directory tree under which the server’s
# configuration, error, and log files are kept.設定ファイルやエラーやログファイルの保管はここで定義したディレクトリ以下に置きますよ。
#
# Do not add a slash at the end of the directory path.  If you point
# ServerRoot at a non-local disk, be sure to specify a local disk on the
# Mutex directive, if file-based mutexes are used.  If you wish to share the
# same ServerRoot for multiple httpd daemons, you will need to change at
# least PidFile.
#
ServerRoot “/etc/httpd”  ←←←「/etc/httpd以下にwebサーバー関連の設定ファイルを置きますよ」ということ
 
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.ここで定義したIPアドレスやポート番号でリクエストを受け付けますよ
#
# Change this to Listen on specific IP addresses as shown below to 
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80 ←←「80番ポートで受け付けますよ」デフォルトは80番
 
#
中略・・・・・・・・
##
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.  
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User apache  ←←httpdの子プロセス所有ユーザー
Group apache ←←httpdの子プロセス所有グループ
 
 
#
中略・・・・・・・・
##
#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed.  This address appears on some server-generated pages, such
# as error documents.  e.g. admin@your-domain.com
#
ServerAdmin root@localhost ←←webサーバーの管理者への連絡先
 
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn’t have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:80 ←←webサーバーのホスト名(デフォルトは空白)
 
#
# Deny access to the entirety of your server’s filesystem. You must
# explicitly permit access to web content directories in other 
# <Directory> blocks below.
#
<Directory />       ←←<Directory>と</Directory>の間に構成情報(ディレクティブ)を書く
    AllowOverride none        ↓
    Require all denied         ↓
</Directory>         下のほうにも<Directory>タグがある
 
#
# Note that from this point forward you must specifically allow
# particular features to be enabled – so if something’s not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
 
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot “/var/www/html”  ←←ドキュメントルートのディレクトリ
 
#
# Relax access to content within /var/www.
#
<Directory “/var/www”>
    AllowOverride None
    # Allow open access:
    Require all granted
</Directory>
 
# Further relax access to the default document root:
<Directory “/var/www/html”>
    #
    # Possible values for the Options directive are “None”, “All”,
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that “MultiViews” must be named *explicitly* — “Options All”
    # doesn’t give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks
 
    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be “All”, “None”, or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride None
 
    #
    # Controls who can get stuff from this server.
    #
    Require all granted
</Directory>
 

以下 略
要は、設定項目(ディレクティブ)名を書いて、値を入れる
特定のディレクトリに対してアクセスを制限したい場合などは、<Directory>タグを使って設定する
ということなのかな?