Linux 位于 apache 的 httpd.conf 文件丢失
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12202021/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Lost httpd.conf file located apache
提问by Shalin Shah
How can I find where my httpd.conf
file is located?
如何找到我的httpd.conf
文件所在的位置?
I am running an Ubuntu Linux server from the Amazon Web Services EC2 (Elastic Compute Cloud) and I can't find my Apache config.
我正在运行来自 Amazon Web Services EC2(弹性计算云)的 Ubuntu Linux 服务器,但我找不到我的 Apache 配置。
采纳答案by squiguy
Get the path of running Apache
获取运行Apache的路径
$ ps -ef | grep apache
apache 12846 14590 0 Oct20 ? 00:00:00 /usr/sbin/apache2
Append -V
argument to the path
将-V
参数附加到路径
$ /usr/sbin/apache2 -V | grep SERVER_CONFIG_FILE
-D SERVER_CONFIG_FILE="/etc/apache2/apache2.conf"
Reference:
http://commanigy.com/blog/2011/6/8/finding-apache-configuration-file-httpd-conf-location
参考:http:
//commanigy.com/blog/2011/6/8/finding-apache-configuration-file-httpd-conf-location
回答by Rich Bowen
See http://wiki.apache.org/httpd/DistrosDefaultLayoutfor discussion of where you might find Apache httpd configuration files on various platforms, since this can vary from release to release and platform to platform. The most common answer, however, is either /etc/apache/conf or /etc/httpd/conf
请参阅http://wiki.apache.org/httpd/DistrosDefaultLayout以讨论您可以在哪里找到各种平台上的 Apache httpd 配置文件,因为这可能因发行版和平台而异。然而,最常见的答案是 /etc/apache/conf 或 /etc/httpd/conf
Generically, you can determine the answer by running the command:
通常,您可以通过运行以下命令来确定答案:
httpd -V
httpd -V
(That's a capital V). Or, on systems where httpd is renamed, perhaps apache2ctl -V
(这是一个大写的 V)。或者,在重命名 httpd 的系统上,也许apache2ctl -V
This will return various details about how httpd is built and configured, including the default location of the main configuration file.
这将返回有关如何构建和配置 httpd 的各种详细信息,包括主配置文件的默认位置。
One of the lines of output should look like:
输出行之一应如下所示:
-D SERVER_CONFIG_FILE="conf/httpd.conf"
-D SERVER_CONFIG_FILE="conf/httpd.conf"
which, combined with the line:
其中,结合以下行:
-D HTTPD_ROOT="/etc/httpd"
-D HTTPD_ROOT="/etc/httpd"
will give you a full path to the default location of the configuration file
将为您提供配置文件默认位置的完整路径