哪儿是 Apache CentOS 中的配置?

[ad_1]

Apache 主要配置文件

在 CentOS 服务器上,包管理器用于安装 Apache Web 服务器(例如 rpm、yum 或 dnf)通常默认放置主 Apache 服务器上以下位置之一中的配置文件:

/etc/apache2/httpd.conf
/etc/apache2/apache2.conf
/etc/httpd/httpd.conf
/etc/httpd/conf/httpd.conf

如果您可以通过命令行访问服务器,则可以确认该服务器的确切位置 Apache 正在通过运行命令加载其配置文件

apachectl -V

或者

httpd -V (如果使用旧版本的 Apache)

任一命令显示 Apache的版本和构建参数:

[[email protected] ~]# apachectl -V
Server version: Apache/2.4.39 (cPanel)
Server built: May 30 2019 20:13:52
Server's Module Magic Number: 20120211:84
Server loaded: APR 1.7.0, APR-UTIL 1.6.1
Compiled using: APR 1.7.0, APR-UTIL 1.6.1
Architecture: 64-bit
Server MPM: event
threaded: yes (fixed thread count)
forked: yes (variable process count)
Server compiled with....
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses disabled)
-D APR_USE_PROC_PTHREAD_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT=256
-D HTTPD_ROOT="/etc/apache2"
-D SUEXEC_BIN="/usr/sbin/suexec"
-D DEFAULT_PIDLOG="/var/run/apache2/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="conf/mime.types"
-D SERVER_CONFIG_FILE="conf/httpd.conf"

HTTPD_ROOT= 行将显示根目录 Apache的安装,以及 SERVER_CONFIG_FILE= 行会告诉你 Apache 配置文件相对于根目录的路径 Apache的安装。

为了使用上面的示例输出来说明这一点, HTTPD_ROOT= 行显示我们的根目录 Apache 如下:

/etc/apache2/

这 Apache 配置文件的相对路径,列为 SERVER_CONFIG_FILE=”conf/httpd.conf“, 是在 Apache 安装的根目录,制作完整路径 Apache 配置文件:

/etc/apache2/conf/httpd.conf

包含文件

除了主要 Apache 上面讨论的配置文件, Apache 设置也可以放在 Apache 包括文件。 包含文件是附加的配置文件, Apache 如果在主配置文件中指示,将读取。

以下是如何在主配置文件中引用这些包含文件的示例:

Include "/etc/apache2/conf.d/includes/post_virtualhost_global.conf"
Include "/etc/apache2/conf.d/*.conf"

第一行指示 Apache 从特定文件中读取附加配置 /etc/apache2/conf.d/includes/post_virtualhost_global.conf。

第二行指示 Apache 从文件夹中的任何文件中读取附加配置 /etc/apache2/conf.d/ 文件名末尾有 .conf,因为 * 是通配符。 例如,/etc/apache2/conf.d/ 中名为“php.conf”的文件将被视为包含文件 Apache,并且将加载其配置。

您可以获得配置文件的完整列表 Apache 通过运行以下命令,当前已加载,包括主配置文件和任何包含文件:

apachectl -t -D DUMP_INCLUDES

访问 Apache 控制面板中的配置

如果 CentOS 服务器安装了用于服务器管理的控制面板,例如 cPanel/WHM 或 Plesk,它的界面将为您提供一个图形菜单来编辑它 Apache 配置文件。 有关导航每个控制面板的更多信息,您可以参考我们的指南 Plesk 入门cPanel/WHM 入门.

[ad_2]

Related Posts