麻烦通过apachectl启动apache

我试图把我们的生产networking服务器转移到一个Linux的盒子。 当我使用apachectl发出启动命令时,什么都不会发生,并且回到命令行。 如果我运行apachectl status ,它告诉我“ELinks:连接被拒绝”。

但是,如果我尝试直接使用httpd -k start来启动apache,就会启动apache进程。

任何想法,为什么我不能使用apachectl来启动它? 另外,通过发出httpd -k start命令启动它是不是一件大事? 我只是总是这样开始,但是担心apache文档中的下面一行

通常,不应该直接调用httpd,而应该在基于Unix的系统上通过apachectl调用

http://httpd.apache.org/docs/2.0/programs/httpd.html

你从apachectl命令收到什么错误? apachectl不过是一个shell脚本,所以你可以用sh -x /path/to/apachectl start调用它。 你会看到很多信息溢出到屏幕上。 如果您没有收到任何错误或输出,并且系统上没有运行httpd进程,则可能需要查看日志文件,例如/var/log/messages

另外,在运行apachectl start命令之后,你也可以发出echo $? 查看退出状态码。 这些都是你可以提供的,所以我们可以进一步帮助。

对于它的价值,我在安装基础Linux系统之后下载了Apache软件包。 他们编译得很好,但没有警告链接包丢失。

  • 所以,确保你已经运行yum install links

    此外,文档中还提到了不同位置的两个类似文件之间的区别: /usr/local/apache2/bin/apachectlusr/sbin/apachectl 。 我结束了使用/usr/sbin/apachectl/usr/local/apache2/bin/apachectl至今仍然返回错误: /usr/local/apache2/apachectl: line 94: lynx: command not found 。 不知道为什么。 然而,Apache使用/usr/sbin/apachectl版本。

  •  [root@]# ls -l /usr/local/apache2/bin/apachectl -rwxr-xr-x. 1 root root 3428 Jan 27 12:11 /usr/local/apache2/bin/apachectl 
  •  [root@]# ls -l /usr/sbin/apachectl -rwxr-xr-x. 1 root root 3916 Dec 8 12:10 /usr/sbin/apachectl 

我被困在文件/etc/httpd/conf/httpd.conf的所有错综复杂中。 我都是为了networking安全,但是对于像我这样的无知的新手来说,它是一个不得已的人,为了最终得到一个简单的服务来开始,不得不涉足大量的Internet帮助文件。

对于任何其他人陷入困境,获得apachectl status返回一个体面的价值 – 我敢打赌,你也被困在我的默认值不是在/etc/httpd/conf/httpd.conf文件中是好的。 取消注释并修改相应的部分。 您可能想要Allow from all <Location /server-info><Location /server-status>点中的全部命令,以确保您的服务正常启动。 确保始终使用service httpd restart 。 然后,当你知道你的Apache服务器运行良好时,你可以减less访问并返回到Deny from all规则。

我也面临同样的问题,要解决这个问题,我需要在httpd.conf文件中启用服务器状态,如./apachectl status命令尝试连接服务器状态页面,默认情况下未configuration


 [root @ bin]#./apachectl状态
                                   未find

   在此服务器上找不到请求的URL /服务器状态。


 [root @ bin]#sh -x ./apachectl status
 + ACMD =状态
 + ARGV =状态
 + HTTPD = / usr / local / rail_apache / bin / httpd
 + test -f / usr / local / rail_apache / bin / envvars
 +。 在/ usr /本地/ rail_apache /斌/ envvars中
 ++ test x'!='x
 ++ LD_LIBRARY_PATH = / usr / local / rail_apache / lib
 ++导出LD_LIBRARY_PATH
 + LYNX ='links -dump'
 + STATUSURL = http://example.com:80 / server-status
 ++ ulimit -H -n
 + ULIMIT_MAX_FILES ='ulimit -S -n 4096'
 +'[''xulimit -S -n 4096''!='x']'
 + ulimit -S -n 4096
 + ERROR = 0
 +'['xstatus = x']'
 + case $ ACMD in
 +链接-dump http://example.com:80/server-status
 + awk'/ process $ / {print; 退出} {打印}'
                                   未find

   在此服务器上找不到请求的URL /服务器状态。
 +退出0