关闭。这个问题是题外话。它目前不接受答案。想改进这个问题?更新问题,使其成为 Stack Overflow 的主题。 9年前关闭。改进这个问题
如何找到我的 httpd.conf
文件所在的位置?
我正在从 Amazon Web Services EC2(弹性计算云)运行 Ubuntu Linux 服务器,但找不到我的 Apache 配置。
find / -name httpd.conf
/etc/httpd/conf/httpd.conf
access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/…
locate httpd.conf
获取运行Apache的路径
$ ps -ef | grep apache
apache 12846 14590 0 Oct20 ? 00:00:00 /usr/sbin/apache2
将 -V
参数附加到路径
$ /usr/sbin/apache2 -V | grep SERVER_CONFIG_FILE
-D SERVER_CONFIG_FILE="/etc/apache2/apache2.conf"
参考:
http://commanigy.com/blog/2011/6/8/finding-apache-configuration-file-httpd-conf-location
请参阅 http://wiki.apache.org/httpd/DistrosDefaultLayout,了解在不同平台上哪里可以找到 Apache httpd 配置文件,因为这可能因版本和平台而异。然而,最常见的答案是 /etc/apache/conf 或 /etc/httpd/conf
通常,您可以通过运行以下命令来确定答案:
httpd -V
(这是一个大写的V)。或者,在重命名 httpd 的系统上,可能是 apache2ctl -V
这将返回有关如何构建和配置 httpd 的各种详细信息,包括主配置文件的默认位置。
其中一行输出应如下所示:
-D SERVER_CONFIG_FILE="conf/httpd.conf"
其中,结合以下行:
-D HTTPD_ROOT="/etc/httpd"
将为您提供配置文件默认位置的完整路径
apache2ctl -V
命令并在后面列出的内容中查找路径。
the command httpd
未找到。
不定期副业成功案例分享
sudo /usr/sbin/apache2 -V | grep SERVER_CONFIG_FILE
给了我一些警告错误Invalid Mutex directory
所以我使用的正确命令是sudo apachectl -V | grep SERVER_CONFIG_FILE