【问题标题】:httpd does not work (-bash: httpd: command not found)httpd 不起作用(-bash: httpd: command not found)
【发布时间】:2014-08-23 17:17:16
【问题描述】:

我在别人的 linux 服务器上(共享主机)。我没有root访问权限。我已经确定它是作为 Centos Release 5.9(Final) 运行的 Redhat 4.1.2-46。

我有该站点的数据库转储以及来自 public_html 的 .php 文件。我正在尝试做的是找到 httpd.conf 文件并获取该站点的配置。

当我输入时

httpd - v

我得到 -bas: httpd: command not found - 即使在 /user/sbin 目录中 - 它显然正在运行。

底线我找不到 www.thisparticularsite.com 的 sitedef/conf 文件 - 甚至无法弄清楚我正在运行的 apache 版本...

【问题讨论】:

  • 假设“即使在 /usr/sbin 目录中”你的意思是你在其中看到了二进制文件,那么/usr/sbin/httpd -v./httpd -v/usr/sbin 中时呢?
  • 看看是否有像/etc/init.d/httpd这样的脚本,通常用于在系统启动时启动Apache。它应该包含httpd 的路径。

标签: apache httpd.conf


【解决方案1】:

如果您尝试查找已加载的模块,之前的命令是 httpd -l。但它会给你同样的错误,Command 'httpd' not found,

现在,您可以使用apache2 -l(在 Apache/2.4.29 上测试)。

【讨论】:

    【解决方案2】:

    对于 Apache 2,请尝试 apache2ctl -v(或 sudo apache2ctl -v,如果 root 访问可用)。我在运行 Debian 的树莓派 4B 上,仅供参考。

    【讨论】:

      【解决方案3】:

      如 apache.org 所述,不应直接调用 httpd 命令。 see source

      【讨论】:

        【解决方案4】:

        apache的init文件通常位于/etc/init.dhttpd路径可以在里面找到。但是,您可以通过执行ps aux|grep -i http 找到httpd.conf 文件和httpd 命令目录的位置。例如:

        ps aux|grep -i http
        
        510       2594  0.0  0.0  77256  1516 ?        S    Jul02   0:00 **/usr/sbin/httpd-0.0.0.0_80** -k start -f **/etc/httpd/conf/instances/httpd-0.0.0.0_80/httpd.conf**
        
        root      5470  0.0  0.0  77120   872 ?        Ss    2013  22:13 **/usr/sbin/httpd-0.0.0.0_80** -k start -f **/etc/httpd/conf/instances/httpd-0.0.0.0_80/httpd.conf**
        

        结论:

        httpd.conf file path: **/etc/httpd/conf/instances/httpd-0.0.0.0_80/httpd.conf**
        httpd command directory: **/usr/sbin/httpd-0.0.0.0_80**
        

        【讨论】:

          猜你喜欢
          • 2019-07-07
          • 2016-01-06
          • 2014-05-18
          • 1970-01-01
          • 2014-07-01
          • 2018-07-18
          • 2010-12-09
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多