有人可以解释一下 Debian Apache2 配置文件难题吗?

有人可以解释一下 Debian Apache2 配置文件难题吗?

我正在运行 Apache 2.4,如下所示:

$ sudo apache2ctl -v
Server version: Apache/2.4.10 (Debian)
Server built:   Jul 23 2014 13:15:48

显然需要配置三个不同的配置文件:-

/etc/apache2$ ls *.conf
apache2.conf  ports.conf

/etc/apache2/conf.d$ ls *.conf
httpd.conf

显然这三个文件的工作原理如下:-

apache2.conf:- 它是全球的配置文件。

ports.conf :- 这显然是告诉 Apache 监听和绑定哪个 IP 地址和端口(以进行 Web 服务)。

httpd.conf :- 这与用户配置有关。我对此不太了解。

现在我有两个问题:-

A。我对这三个文件的理解是否正确?如果有人能更好地解释那就太好了。

b.为什么 httpd.conf 应该位于 /etc/apache2/conf.d/httpd.conf 中,而其他两个位于 /etc/apache2/ 中?

答案1

A。我对这三个文件的理解是否正确?如果有人能更好地解释那就太好了。

总的来说,这是正确的。但如果您打开,您可以阅读更多详细信息/etc/apache2/apache2.conf

# * apache2.conf is the main configuration file (this file). It puts the pieces
#   together by including all remaining configuration files when starting up the
#   web server.
#
#   ....
#
# * ports.conf is always included from the main configuration file. It is
#   supposed to determine listening ports for incoming connections, and which
#   of these ports are used for name based virtual hosts.

对于httpd.conf,我认为它的存在只是为了与其他需要它的程序兼容。这只是一个普通的apache配置文件。

b.为什么 httpd.conf 应该位于 /etc/apache2/conf.d/httpd.conf 中,而其他两个位于 /etc/apache2/ 中?

因为它是 Debian 中的默认设计。再次来自/etc/apache2/apache2.conf

# The Apache 2 web server configuration in Debian is quite different to
# upstream's suggested way to configure the web server. This is because Debian's
# default Apache2 installation attempts to make adding and removing modules,
# virtual hosts, and extra configuration directives as flexible as possible, in
# order to make automating the changes and administering the server as easy as
# possible.

# It is split into several files forming the configuration hierarchy outlined
# below, all located in the /etc/apache2/ directory:
#
#   /etc/apache2/
#   |-- apache2.conf
#   |   `--  ports.conf
#   |-- mods-enabled
#   |   |-- *.load
#   |   `-- *.conf
#   |-- conf.d
#   |   `-- *
#   `-- sites-enabled
#       `-- *

笔记

相关内容