Apache 错误:AH00526 参数文件中无效的互斥目录:${APACHE_LOCK_DIR}(Apache2 Ubuntu VPS 服务器))

2023-12-20

每当我跑步时sudo apache2 -S在我的服务器上它抛出以下错误:

[Sun Mar 04 16:17:22.303217 2018] [core:warn] [pid 31405] AH00111: Config variable ${APACHE_LOCK_DIR} is not defined
[Sun Mar 04 16:17:22.303414 2018] [core:warn] [pid 31405] AH00111: Config variable ${APACHE_PID_FILE} is not defined
[Sun Mar 04 16:17:22.303503 2018] [core:warn] [pid 31405] AH00111: Config variable ${APACHE_RUN_USER} is not defined
[Sun Mar 04 16:17:22.303577 2018] [core:warn] [pid 31405] AH00111: Config variable ${APACHE_RUN_GROUP} is not defined
[Sun Mar 04 16:17:22.303655 2018] [core:warn] [pid 31405] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Sun Mar 04 16:17:22.306324 2018] [core:warn] [pid 31405:tid 140656836052864] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
AH00526: Syntax error on line 74 of /etc/apache2/apache2.conf:
Invalid Mutex directory in argument file:${APACHE_LOCK_DIR}

我已经尝试了几件事,但它一直给我这些错误......我做了一些调整apache2.conf但这最终不起作用,所以我恢复了我的更改,尝试下载默认值ennvar没用

My /etc/apache2/apache2.conf文件看起来像这样:

            # This is the main Apache server configuration file.  It contains the
            # configuration directives that give the server its instructions.
            # See http://httpd.apache.org/docs/2.4/ for detailed information about
            # the directives and /usr/share/doc/apache2/README.Debian about Debian specific
            # hints.
            #
            #
            # Summary of how the Apache 2 configuration works in Debian:
            # The Apache 2 web server configuration in Debian is quite different to
            # upstream's suggested way to configure the web server. This is because Debian's
            # default Apache2 installation attempts to make adding and removing modules,
            # virtual hosts, and extra configuration directives as flexible as possible, in
            # order to make automating the changes and administering the server as easy as
            # possible.

            # It is split into several files forming the configuration hierarchy outlined
            # below, all located in the /etc/apache2/ directory:
            #
            #   /etc/apache2/
            #   |-- apache2.conf
            #   |   `--  ports.conf
            #   |-- mods-enabled
            #   |   |-- *.load
            #   |   `-- *.conf
            #   |-- conf-enabled
            #   |   `-- *.conf
            #   `-- sites-enabled
            #       `-- *.conf
            #
            #
            # * apache2.conf is the main configuration file (this file). It puts the pieces
            #   together by including all remaining configuration files when starting up the
            #   web server.
            #
            # * ports.conf is always included from the main configuration file. It is
            #   supposed to determine listening ports for incoming connections which can be
            #   customized anytime.
            #
            # * Configuration files in the mods-enabled/, conf-enabled/ and sites-enabled/
            #   directories contain particular configuration snippets which manage modules,
            #   global configuration fragments, or virtual host configurations,
            #   respectively.
            #
            #   They are activated by symlinking available configuration files from their
            #   respective *-available/ counterparts. These should be managed by using our
            #   helpers a2enmod/a2dismod, a2ensite/a2dissite and a2enconf/a2disconf. See
            #   their respective man pages for detailed information.
            #
            # * The binary is called apache2. Due to the use of environment variables, in
            #   the default configuration, apache2 needs to be started/stopped with
            #   /etc/init.d/apache2 or apache2ctl. Calling /usr/bin/apache2 directly will not
            #   work with the default configuration.


            # Global configuration
            #

            #
            # ServerRoot: The top of the directory tree under which the server's
            # configuration, error, and log files are kept.
            #
            # NOTE!  If you intend to place this on an NFS (or otherwise network)
            # mounted filesystem then please read the Mutex documentation (available
            # at <URL:http://httpd.apache.org/docs/2.4/mod/core.html#mutex>);
            # you will save yourself a lot of trouble.
            #
            # Do NOT add a slash at the end of the directory path.
            #
            ServerRoot "/etc/apache2"

            #
            # The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
            #
            Mutex file:${APACHE_LOCK_DIR} default

            #
            # PidFile: The file in which the server should record its process
            # identification number when it starts.
            # This needs to be set in /etc/apache2/envvars
            #
            PidFile ${APACHE_PID_FILE}

            #
            # Timeout: The number of seconds before receives and sends time out.
            #
            Timeout 300

            #
            # KeepAlive: Whether or not to allow persistent connections (more than
            # one request per connection). Set to "Off" to deactivate.
            #
            KeepAlive On

            #
            # MaxKeepAliveRequests: The maximum number of requests to allow
            # during a persistent connection. Set to 0 to allow an unlimited amount.
            # We recommend you leave this number high, for maximum performance.
            #
            MaxKeepAliveRequests 100

            #
            # KeepAliveTimeout: Number of seconds to wait for the next request from the
            # same client on the same connection.
            #
            KeepAliveTimeout 5


            # These need to be set in /etc/apache2/envvars
            User ${APACHE_RUN_USER}
            Group ${APACHE_RUN_GROUP}

            #
            # HostnameLookups: Log the names of clients or just their IP addresses
            # e.g., www.apache.org (on) or 204.62.129.132 (off).
            # The default is off because it'd be overall better for the net if people
            # had to knowingly turn this feature on, since enabling it means that
            # each client request will result in AT LEAST one lookup request to the
            # nameserver.
            #
            HostnameLookups Off

            # ErrorLog: The location of the error log file.
            # If you do not specify an ErrorLog directive within a <VirtualHost>
            # container, error messages relating to that virtual host will be
            # logged here.  If you *do* define an error logfile for a <VirtualHost>
            # container, that host's errors will be logged there and not here.
            #
            ErrorLog ${APACHE_LOG_DIR}/error.log

            #
            # LogLevel: Control the severity of messages logged to the error_log.
            # Available values: trace8, ..., trace1, debug, info, notice, warn,
            # error, crit, alert, emerg.
            # It is also possible to configure the log level for particular modules, e.g.
            # "LogLevel info ssl:warn"
            #
            LogLevel warn

            # Include module configuration:
            IncludeOptional mods-enabled/*.load
            IncludeOptional mods-enabled/*.conf

            # Include list of ports to listen on
            Include ports.conf


            # Sets the default security model of the Apache2 HTTPD server. It does
            # not allow access to the root filesystem outside of /usr/share and /var/www.
            # The former is used by web applications packaged in Debian,
            # the latter may be used for local directories served by the web server. If
            # your system is serving content from a sub-directory in /srv you must allow
            # access here, or in any related virtual host.
            <Directory />
                Options FollowSymLinks
                AllowOverride None
                Require all denied
            </Directory>

            <Directory /usr/share>
                AllowOverride None
                Require all granted
            </Directory>

            <Directory /var/www/>
                Options Indexes FollowSymLinks
                AllowOverride None
                Require all granted
            </Directory>

            #<Directory /srv/>
            #   Options Indexes FollowSymLinks
            #   AllowOverride None
            #   Require all granted
                IncludeOptional sites-enabled/*.conf
            #</Directory>




            # AccessFileName: The name of the file to look for in each directory
            # for additional configuration directives.  See also the AllowOverride
            # directive.
            #
            AccessFileName .htaccess

            #
            # The following lines prevent .htaccess and .htpasswd files from being
            # viewed by Web clients.
            #
            <FilesMatch "^\.ht">
                Require all denied
            </FilesMatch>


            #
            # The following directives define some format nicknames for use with
            # a CustomLog directive.
            #
            # These deviate from the Common Log Format definitions in that they use %O
            # (the actual bytes sent including headers) instead of %b (the size of the
            # requested file), because the latter makes it impossible to detect partial
            # requests.
            #
            # Note that the use of %{X-Forwarded-For}i instead of %h is not recommended.
            # Use mod_remoteip instead.
            #
            LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
            LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
            LogFormat "%h %l %u %t \"%r\" %>s %O" common
            LogFormat "%{Referer}i -> %U" referer
            LogFormat "%{User-agent}i" agent

            # Include of directories ignores editors' and dpkg's backup files,
            # see README.Debian for details.

            # Include generic snippets of statements
            IncludeOptional conf-enabled/*.conf

            # Include the virtual host configurations:
            IncludeOptional sites-enabled/*.conf

            # vim: syntax=apache ts=4 sw=4 sts=4 sr noet

可能是什么问题,我错过了什么?

这篇文章是这篇文章的延续:Ubuntu 服务器上的虚拟主机 Apache 不工作 https://stackoverflow.com/questions/49085166/virtualhost-apache-on-ubuntu-server-not-working

EDIT

I added export APACHE_LOCK_DIR=/var/lock/apache2$SUFFIX, export APACHE_RUN_USER=www-data and export APACHE_RUN_GROUP=www-data to envvars并运行这些命令sudo service apache2 restart and # sudo apachectl -k start -S。这给了我以下输出:

      root@vps520749:~# sudo apachectl -k start -S
      VirtualHost configuration:
      *:80                   vps520749.ovh.net (/etc/apache2/sites-enabled/000-default.conf:1)
      ServerRoot: "/etc/apache2"
      Main DocumentRoot: "/var/www/html"
      Main ErrorLog: "/var/log/apache2/error.log"
      Mutex default: dir="/var/run/apache2/" mechanism=default
      Mutex watchdog-callback: using_defaults
      PidFile: "/var/run/apache2/apache2.pid"
      Define: DUMP_VHOSTS
      Define: DUMP_RUN_CFG
      User: name="www-data" id=33
      Group: name="www-data" id=33

现在一旦我跑了sudo apache2 -S这是我的输出:

    [Tue Mar 06 00:46:48.762674 2018] [core:warn] [pid 11162] AH00111: Config variab          le ${APACHE_PID_FILE} is not defined
    [Tue Mar 06 00:46:48.762883 2018] [core:warn] [pid 11162] AH00111: Config variab          le ${APACHE_RUN_USER} is not defined
    [Tue Mar 06 00:46:48.762967 2018] [core:warn] [pid 11162] AH00111: Config variab          le ${APACHE_RUN_GROUP} is not defined
    [Tue Mar 06 00:46:48.763091 2018] [core:warn] [pid 11162] AH00111: Config variab          le ${APACHE_LOG_DIR} is not defined
    [Tue Mar 06 00:46:48.765580 2018] [core:warn] [pid 11162:tid 139874816681856] AH          00111: Config variable ${APACHE_LOG_DIR} is not defined
    [Tue Mar 06 00:46:48.765970 2018] [core:warn] [pid 11162:tid 139874816681856] AH          00111: Config variable ${APACHE_LOG_DIR} is not defined
    [Tue Mar 06 00:46:48.766049 2018] [core:warn] [pid 11162:tid 139874816681856] AH          00111: Config variable ${APACHE_LOG_DIR} is not defined
    AH00543: apache2: bad user name ${APACHE_RUN_USER}

这些消息是意料之中的。 当直接调用 Apache 二进制文件时,它会忽略以下内容/etc/apache2/envvars文件。 如果 Apache 通过 init 文件启动或apachectl。 确保变量已定义:

# grep lock /etc/apache2/envvars 
export APACHE_LOCK_DIR=/var/lock/apache2$SUFFIX

And use:

# sudo apachectl -k start -S
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Apache 错误:AH00526 参数文件中无效的互斥目录:${APACHE_LOCK_DIR}(Apache2 Ubuntu VPS 服务器)) 的相关文章

  • 点击取消时 htpasswd 被绕过

    在我的 htaccess 中 我有以下代码 用于保存 admin 区域 如果我提供了错误的用户名密码 它会不断弹出正确的用户名 但如果我按取消 我可以看到我的限制区域 而不是加载错误页面 这是怎么回事 谢谢 AuthName Restric
  • 配置失败,因为找不到 libcurl

    我正在尝试使用从远程服务器提取一些 json 数据fromJSON gt server lt http 111 111 000 00 3000 gt streams lt fromJSON paste server output strea
  • http://localhost:50070/ 的 hadoop Web UI 不起作用

    命令 jps 显示以下详细信息 第5144章 5464 节点管理器 5307 资源管理器 5800 Jps 显然namenode和datanode丢失了 网络用户界面位于http 本地主机 50070 http localhost 5007
  • 使用 Nginx 或 Apache 来提供动态内容? [关闭]

    就目前情况而言 这个问题不太适合我们的问答形式 我们希望答案得到事实 参考资料或专业知识的支持 但这个问题可能会引发辩论 争论 民意调查或扩展讨论 如果您觉得这个问题可以改进并可能重新开放 访问帮助中心 help reopen questi
  • 为什么 Xampp 控制面板在启动时显示错误访问被拒绝 [关闭]

    Closed 这个问题不符合堆栈溢出指南 help closed questions 目前不接受答案 我的 Xampp 控制面板遇到问题 当我尝试启动它时 它会弹出一条错误消息 错误 无法创建文件 C xampp xampp control
  • IntelliJ IDEA 无法在 Ubuntu 上启动

    我用IDEA好几个月了 到现在还可以 现在从快捷方式启动IDEA没有效果 我想这是在一些更新之后发生的 我尝试重新安装IDEA 但问题仍然存在 从终端启动 idea sh 会产生类似的效果 chronoexp ChronoExp PC Pr
  • 如何将推送的分支复制到另一个目录?

    我有一个分支叫master 生产 另一个称为development 当我从 master 推送提交时 post receive 挂钩执行 git work tree var www mywebsite com git dir var rep
  • pygraphviz,导入错误:未定义的符号:Agundirected

    import pygraphviz Traceback most recent call last File
  • 无法安装 psycopg2 Ubuntu

    试图为 django 项目准备好服务器 但我在设置 postgres 时遇到了一些问题 我正在遵循本指南 https jee appy blogspot com 2017 01 deply django with nginx html ht
  • 配置 shiro.ini 以进行 JDBC 连接

    作为我新的一年学习新技术计划的一部分 我开始尝试使用 Apache Shiro 安全框架 我设法让基本示例正常工作 该示例将用户名 密码和角色存储在 shiro ini 文件中 但是当我修改 shiro ini 文件以使用 JDBC 时 它
  • 仅当未找到文件时才重定向请求?

    我希望有一种方法可以使用 mod rewrite 和 Apache 来做到这一点 但也许还有另一种方法可以考虑 在我的网站上 我为客户的网站重新设计版本设置了目录 如果网络根目录是 home blah www 客户端目录将是 home bl
  • 有没有人在 Ubuntu 16.04 LTS 上安装 QGIS

    按照以下网址提供的说明进行操作 这一页 http www qgis org en site forusers alldownloads html并收到以下错误 以下软件包具有未满足的依赖关系 python qgis Depends pyth
  • nginx 反向代理到 apache-wordpress 可以工作,但到外部 url 的 proxy_pass 失败

    我有一个针对 apache wordpress 的 nginx 反向代理设置 效果很好 但是 根据位置需要重定向到失败的外部 url 请检查以下配置 这是一个有效的设置吗 https platform com https platform
  • EDITLogBack Syslog 不工作 java

    我写了一个简单的项目来在 Ubuntu 中运行日志 方法如下example https examples javacodegeeks com enterprise java logback logback syslog example 应用
  • PHP 文件由浏览器下载,而不是由本地开发服务器(MAMP)处理

    一切都很顺利 直到我添加AddHandler application x httpd php5s php到本地服务器文档根目录中的 htaccess 文件 根据我正在使用的站点 我经常更改该文件 因为我访问时这样做了http 本地主机 88
  • 如何在 Linux 主机上的 docker 容器中挂载目录 [重复]

    这个问题在这里已经有答案了 我想将一个目录从 docker 容器挂载到本地文件系统 该目录是网站根目录 我需要能够使用任何编辑器在本地计算机上编辑它 我知道我可以跑docker run v local path container path
  • 将 Docker 与具有 Node-gyp 依赖项的 Nodejs 一起使用

    我计划使用 Docker 部署 node js 应用程序 该应用程序有几个需要node gyp的依赖项 Node gyp 根据交付平台上的编译库构建这些模块 例如 canvas lwip qrcode 根据我的经验 这些构建可能高度依赖于操
  • 如何查明 Ubuntu 上安装了哪个版本的 GTK+?

    我需要确定 Ubuntu 上安装了哪个版本的 GTK 男人似乎不帮忙 这个建议 https stackoverflow com a 126145 会告诉您安装了哪个 2 0 的次要版本 不同的主要版本将具有不同的包名称 因为它们可以在系统上
  • 如何安装和管理多个版本的 R 包

    我正在开发一个使用 R 进行可重现计算的框架 我正在努力解决的一个问题是 某些 R 代码可能在包的 X Y Z 版本中完美运行 但是为什么你在 3 年后尝试重现它 这些包已经更新了 一些功能发生了变化 代码不再运行 此问题还会影响使用包的
  • Puppeteer 无法在 VPS (DigitalOcean) 上工作

    我在水滴中数字海洋 https www digitalocean com 我收到这个错误 node 5549 UnhandledPromiseRejectionWarning TimeoutError Navigation Timeout

随机推荐