我们如何找到 CentOS 中 httpd 包的默认配置文件所在的位置?
通过使用 RPM 命令,我们可以查询一个包以找到它所有相关的配置文件。
如果失败,我们可以使用 find 命令在文件系统中搜索这些文件。
find命令
如果我们不使用包来安装 Apache,而是从源代码编译它或者以其他方式安装到自定义位置,我们可以轻松地在整个文件系统中运行 find 来查找这些文件。
[jack@onitroad ~]# find / -name httpd.conf /etc/httpd/conf/httpd.conf /usr/lib/tmpfiles.d/httpd.conf
上面的示例将搜索文件系统“/”的根目录,并找到每个名为“httpd.conf”的文件。
不要忘记,如果我们编辑任何 Apache 配置文件,我们将需要重新加载或者重新启动 Apache 使更改生效。
RPM 查询配置文件
我们将与 RPM 命令一起使用的选项是 -q 用于查询包,以及 -c 将列出作为包一部分的配置文件。
如下所示,我们在 httpd 包上运行了带有 -qc 选项的 RPM,这是 CentOS 中 Apache 的来源。
[jack@onitroad ~]# rpm -qc httpd /etc/httpd/conf.d/autoindex.conf /etc/httpd/conf.d/userdir.conf /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.modules.d/00-base.conf /etc/httpd/conf.modules.d/00-dav.conf /etc/httpd/conf.modules.d/00-lua.conf /etc/httpd/conf.modules.d/00-mpm.conf /etc/httpd/conf.modules.d/00-proxy.conf /etc/httpd/conf.modules.d/00-systemd.conf /etc/httpd/conf.modules.d/01-cgi.conf /etc/httpd/conf/httpd.conf /etc/httpd/conf/magic /etc/logrotate.d/httpd /etc/sysconfig/htcacheclean /etc/sysconfig/httpd
这些是 httpd 包安装的所有默认配置文件。
主要的 Apache 配置文件是 /etc/httpd/conf/httpd.conf,对 Apache 的大部分更改都会在这里进行。
日期:2020-07-07 20:56:58 来源:oir作者:oir