httpd在通过rc脚本加载时不加载httpd.conf文件

二进制文件位于/usr/sbin/

当我运行strace -o httpdstart.txt /usr/bin/httpd -k start

它有以下几行来打开httpd.conf

 stat("/etc/httpd/conf/httpd.conf", {st_mode=S_IFREG|0644, st_size=35894, ...}) = 0 open("/etc/httpd/conf/httpd.conf", O_RDONLY|O_CLOEXEC) = 3 

所以当通过手动加载时:

 httpd -k start 

要么

 /usr/bin/httpd -k start 

按照预期的httpd加载/etc/httpd/conf/httpd.conf进行configuration。

我也运行strace -o httpdstart.txt /etc/init.d/httpd -k start

我得到:

 Usage: httpd {start|stop|restart|condrestart|try-restart|force-reload|reload|status|fullstatus|graceful|help|configtest} 

所以用法说,我不能使用httpd rc脚本的任何选项。

所以我运行strace -o httpdstart1.txt /etc/init.d/httpd start 。 它没有打开任何httpd.conf文件的痕迹。


init.d中的httpd rc脚本具有:

 apachectl=/usr/sbin/apachectl httpd=${HTTPD-/usr/sbin/httpd} 

即它指向正确的二进制文件。


httpd -V具有以下输出:

服务器版本:Apache / 2.2.21(Unix)
服务器构build:9月13 2011年13:46:54
服务器模块Magic Number:20051115:30
服务器加载:APR 1.4.5,APR-Util 1.3.10
编译使用:APR 1.4.5,APR-Util 1.3.12
架构:64位
Server MPM:Prefork
线程:不
分叉:是(可变进程数)
服务器编译…
-D APACHE_MPM_DIR =“server / mpm / prefork”
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6(启用IPv4映射地址)
-D APR_USE_SYSVSEM_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT = 128
-D HTTPD_ROOT =“/ etc / httpd”
-D SUEXEC_BIN =“/ usr / sbin / suexec”
-D DEFAULT_PIDLOG =“logs / httpd.pid”
-D DEFAULT_SCOREBOARD =“logs / apache_runtime_status”
-D DEFAULT_LOCKFILE =“logs / accept.lock”
-D DEFAULT_ERRORLOG =“logs / error_log”
-D AP_TYPES_CONFIG_FILE =“conf / mime.types”
-D SERVER_CONFIG_FILE =“conf / httpd.conf”


当通过rcscript加载时,DocumentRoot不会被设置和

 ErrorDocument 403 /error/noindex.html 

发生(在welcome.conf中),并加载Fedora Test Page 。 如果我删除了welcome.conf。 我将得到一个Forbidden You don't have permission to access / on this server 。 这里怎么了?

它看起来像是两个不同的apaches。 一个在/ usr / bin / httpd,另一个在/ usr / sbin / httpd。 尝试手动启动“sbin”,并查看httpd -V的输出是否与通过rc脚本启动时相同。