如何查看完整的 httpd 配置? [英] How can I view the complete httpd configuration?

查看:52
本文介绍了如何查看完整的 httpd 配置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想弄清楚 httpd 设置的完整配置是什么.

I'm trying to figure out what is the full complete configuration of an httpd setup.

所有的配置文件都分散在不同的文件中(/etc/httpd/conf.d、httpd.conf、各种mod配置)

All the configurations files are scattered in different files (/etc/httpd/conf.d, httpd.conf, various mod configs)

有没有办法列出最终的 httpd 配置?
像单个文件中的整个运行设置配置一样吗?

Is there a way to list the final httpd configuration?
Like the whole running setup configuration in a single file?

推荐答案

正如 arco444 所指出的,您可以使用 apachectl -S 从配置中显示当前运行的 VirtualHosts 的概览,并且 apachectl -M 来显示所有当前加载的模块 - 我不知道有什么工具可以显示在 httpd 启动时解析的所有配置的详细输出(以及解析它们的顺序),但我会建议您熟悉httpd 配置文件的一般结构:

As noted by arco444, you can use apachectl -S to display an overview of the VirtualHosts currently running from the configs, and apachectl -M to display all currently loaded modules - I'm not aware of a tool to display the verbose output of all configs parsed (and which order they were parsed in) at launch of httpd, but I would recommend that you familiarise yourself with the general structure of the httpd config files:

特别注意您的问题:'main' apache 配置文件位于 /etc/httpd/conf/httpd.conf(在默认 httpd 安装的第 221 行区域中)CentOS 6 中包含的存储库,我假设您根据您的帖子标签使用),并且补充"配置文件位于 /etc/httpd/conf.d 中,并且需要包含在内明确地在主配置文件中.例如,如果您在 httpd.conf 文件中搜索术语Include",您将找到行 Include conf.d/*.conf 包含子目录 conf.d 中所有扩展名为 .conf 的文件 - 按字母顺序排列,因此您需要熟悉配置文件的重要性如果可能,在某个时候解析.

Of particular note to your question: the 'main' apache config file is located in /etc/httpd/conf/httpd.conf (in the region of line 221 on a default httpd installation from the repos included in CentOS 6, which I assume you are using based on your post tags), and the 'supplementary' config files are located in /etc/httpd/conf.d and require to be included explicitly in the main config file. For example, if you search the httpd.conf file for the term 'Include', you will find the line Include conf.d/*.conf which is what includes all files of extension .conf in the subdirectory conf.d - in alphabetical order, so you will want to familiarise yourself with the importance of config file parsing at some point if possible.

顺便说一句,如果您使用的是基于 shell 的文本编辑器,例如 vim,我建议您默认启用行编号和语法高亮显示,这样冗长的配置文件更容易自己解析和导航 - 在在 vim 的情况下,您可以通过在您的主目录中创建一个名为 .vimrc 的文件(或附加到现有文件)并添加以下行来实现:

As an aside, if you are using a shell based text editor such as vim, I suggest that you enable line numbering and syntax highlighting by default so that such lengthy config files are a bit easier to parse yourself and navigate - in the case of vim, you'd do so by creating a file in your home directory called .vimrc (or append to an existing one) and add the following lines:

set nu
syntax on

这篇关于如何查看完整的 httpd 配置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆