Linux Apache 默认安装 httpd.conf 在哪里?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17134015/
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
Where does Apache install httpd.conf by default?
提问by user1032531
I thought Apache's httpd.conf is typically located at /etc/httpd/conf/httpd.conf
. But for my installation as described below on Centos 6.4, it is located at /usr/local/apache2/conf/httpd.conf
. On top of that, DocumentRoot is set to /usr/local/apache2/htdocs
instead of the traditional /var/www/html
.
我认为 Apache 的 httpd.conf 通常位于/etc/httpd/conf/httpd.conf
. 但是对于我在 Centos 6.4 上如下所述的安装,它位于/usr/local/apache2/conf/httpd.conf
. 最重要的是, DocumentRoot 被设置为/usr/local/apache2/htdocs
而不是传统的/var/www/html
.
Where is the most common location for these to be located? If different than what I am showing, what did I do wrong? Thank you
这些最常见的位置在哪里?如果与我展示的不同,我做错了什么?谢谢
First I did the following:
首先我做了以下事情:
- Unpack Apache 2.4.4 to /usr/local/src
- Unpack APR 1.4.6 to /usr/local/src/httpd-2.4.4/srclib/apr
- Unpack APR-Util 1.5.2 to /usr/local/src/httpd-2.4.4/srclib /apr-util
- Unpack PCRE 8.33 to /usr/local/src
- 将 Apache 2.4.4 解压到 /usr/local/src
- 将 APR 1.4.6 解压到 /usr/local/src/httpd-2.4.4/srclib/apr
- 将 APR-Util 1.5.2 解压到 /usr/local/src/httpd-2.4.4/srclib /apr-util
- 将 PCRE 8.33 解压到 /usr/local/src
Then I did the following
然后我做了以下
$ cd /usr/local/src/httpd-2.4.4/srclib/apr
$ ./configure
$ make
$ make install
$ cd /usr/local/src/httpd-2.4.4/srclib/ apr-util
$ ./configure --with-apr=../apr (verify if any other options are desired)
$ make
$ make install
$ cd /usr/local/src/pcre-8.33
$ ./configure
$ make
$ make install
$ cd /usr/local/src/httpd-2.4.4
$ ./configure --enable-so –enable-rewrite –enable-ssl –with-pcre
$ make
$ make install
采纳答案by innaM
What you did "wrong" was to not read the documentation, which clearly states:
你做的“错误”是没有阅读文档,其中明确指出:
PREFIX must be replaced with the filesystem path under which the server should be installed. If PREFIX is not specified, it defaults to /usr/local/apache2.
PREFIX 必须替换为应该安装服务器的文件系统路径。如果未指定 PREFIX,则默认为 /usr/local/apache2。
However, I put "wrong" in quotes because I cannot find anything wrong with those directories. What's so bad about /usr/local
?
但是,我将“错误”放在引号中,因为我找不到这些目录有什么问题。有什么不好/usr/local
?
回答by abhishek verma
There will be no problem with httpd.conf in /usr/local. The only problem will be that others will not be expecting it there so they might become confused. Rest is okay. While compiling you should have mentioned /etc/httpd/conf/httpd.conf, but I will say still its not a problem.
/usr/local 中的httpd.conf 不会有问题。唯一的问题是其他人不会期待它在那里,所以他们可能会感到困惑。休息没问题。编译时你应该提到/etc/httpd/conf/httpd.conf,但我会说它仍然不是问题。
Do you had any particular reason for compiling Apache and not using yum. If you have used yum, the file would have automatically landed in /etc/httpd/conf/httpd.conf.
你有什么特别的理由编译 Apache 而不是使用 yum。如果您使用过 yum,该文件将自动位于 /etc/httpd/conf/httpd.conf。