閉じる

Apache(Webサーバーの構築・設定)

[root@server1 ~]# dnf -y install httpd php php-mbstring ← httpd・php・php-mbstringをインストールします。

ServerName www.zoah.net:80 ← サーバー名を指定

<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.0/mod/core.html#options
# for more information.
#
    Options Indexes FollowSymLinks
  ↓
    Options Includes ExecCGI FollowSymLinks ← CGI,SSIを許可します。

#
# 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
  ↓
    AllowOverride All ← .htaccessを許可します。

AddDefaultCharset UTF-8
↓
#AddDefaultCharset UTF-8 ← コメントアウト(文字化け対応)

#AddHandler cgi-script .cgi
↓
AddHandler cgi-script .cgi .pl ← CGIスクリプトに.plを追加します。

以下を最終行に追加
TraceEnable off ← Traceメソッドを無効化します。

[root@server1 ~]# vi /etc/httpd/conf.d/autoindex.conf ← autoindex設定ファイルを編集します。

<Directory "/usr/share/httpd/icons">
    Options MultiViews ← iconsディレクトリのファイル一覧を表示しないようにします。
    AllowOverride None
    Require all granted
</Directory>

[root@server1 ~]# ln -s /usr/bin/perl /usr/local/bin/perl ← /usr/local/bin/perlから/usr/bin/perlへシンボリックリンクをはります。

[root@server1 ~]# chown test. /var/www/html/ ← ドキュメントルート所有者を変更します。(例:test)

↓ /etc/httpd/conf.d/mpm.conf を編集して、チューニングします。

<IfModule mpm_event_module>
# 最大同時リクエスト数
MaxRequestWorkers 2200

# 子プロセス数の設定可能な上限値
ServerLimit 2200

# 最初に起動する子プロセスの数
StartServers 20

# 子プロセス毎のスレッド数(ThreadsPerChild)の設定可能な上限値。
ThreadLimit 440

# 子プロセスそれぞれに生成されるスレッド数
ThreadsPerChild 440

# アイドル状態のスレッド最小数
MinSpareThreads 440

# アイドル状態のスレッド最大数
MaxSpareThreads 1320

# 子プロセスが稼働中に扱うリクエスト数の上限
MaxConnectionsPerChild 300
</IfModule>

[root@server1 ~]# systemctl start httpd ← Apacheを起動します。


[root@server1 ~]# systemctl enable httpd ← Apacheを自動起動するように設定します。

© 2025 Linuxで自宅サーバー(ホームサーバー)-構築・設定方法- | WordPress テーマ: CrestaProject の Annina Free