【问题标题】:Error in template in Apache cookbook when running to an Ubuntu Server运行到 Ubuntu 服务器时,Apache 食谱中的模板出错
【发布时间】:2014-03-04 01:26:24
【问题描述】:

我在我的数字 Ocean 帐户中使用 Chef 来构建液滴/实例。我的服务器是 Ubuntu 12.04 x64 。 在我的 Cheffile 中,我有

...
site 'http://community.opscode.com/api/v1'

cookbook 'apache2',
    :git =>'https://github.com/opscode-cookbooks/apache2'
....

在我的节点 json 中:

...
"apache": {
"default_modules" : 
  ["status","alias","auth_basic","autoindex","dir","env","mime","negotiation","setenvif"]
  },
...
"run_list": [
"recipe[gearman]",
"recipe[postgresql::server]",
"recipe[php]",
"recipe[apache2]",
"recipe[apache2::mod_php5]",
"recipe[mysql]",
"recipe[mysql::server]"

]

由于 authz 的一些错误,我不得不限制模块。但是现在,我总是收到错误

 * The apache2 configtest failed.
STDERR: Output of config test was:
AH00526: Syntax error on line 11 of /etc/apache2/apache2.conf:
Invalid command 'LockFile', perhaps misspelled or defined by a module not included in the server configuration
Action 'configtest' failed.

我的配置有什么问题导致出现错误:

  • Apache 传统设置(包含所有模块?)
  • Lo​​ckFile 的模板错误?

【问题讨论】:

  • This 可能是相关的。设置 mod_xml2enc 或编辑模板以使用 Mutex 而不是 LockFile。
  • 如果@Hamid_Nazari 指出的解决方案不起作用,请提供apache2.conf 文件的相关部分。

标签: apache ubuntu apache2 chef-infra opscenter


【解决方案1】:

看起来这可能是 Chef 和 A​​pache2 配方的一个已知问题。

在操作码问题跟踪器上查看相关票证。

https://tickets.opscode.com/browse/COOK-3837

https://tickets.opscode.com/browse/COOK-3838

https://tickets.opscode.com/browse/COOK-3900

现在您或许可以尝试通过覆盖属性来安装 apache 2.2 版

default['apache']['package']

【讨论】:

  • 那么 default['apache']['package'] 的正确值是多少?
【解决方案2】:

我已经找到了一个临时的解决方法,至少在食谱更新之前。

替换位于 apache2/templates/apache2.conf.erb 中的配置中的以下部分。

LockFile /var/lock/apache2/accept.lock

有了这个:

Mutex file:${APACHE_LOCK_DIR} default

【讨论】:

  • 您还想从 default_modules 中删除 mod_authz_default:default['apache']['default_modules'] = ['status', 'alias', 'auth_basic', 'authn_file', 'authz_groupfile', 'authz_host', 'authz_user', 'autoindex', 'dir', 'env', 'mime', 'negotiation', 'setenvif']
【解决方案3】:

我也遇到过类似的问题,我只是想使用 chef-solo 将我的 ubuntu/trusty64 与 apache2 一起流浪。确切地说是 Ubuntu 14 和 Apache 2.4。

它工作后:

  1. 按照上面 jmreicha 的回答
  2. 删除从http://httpd.apache.org/docs/current/upgrading.html 2.4 中删除的模块“mod_authz_default”

很遗憾,我认为这个基本配置应该可以开箱即用。如上所述,从 apache2.2 迁移到 apache2.4 计划在这里:https://tickets.opscode.com/browse/COOK-3900

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-04-26
    • 1970-01-01
    • 2013-08-21
    • 2021-07-28
    • 2015-01-14
    • 2017-04-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多