3

I'm using Chef in my digital Ocean account, to build a droplet/instance. My server a Ubuntu 12.04 x64 . In my Cheffile i have

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

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

And in my node 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]"

]

I had to already limit the modules because of some error with authz. But now, I'm always receiving the error

 * 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.

Whats is wrong with my configuration to have erros in:

  • Apache traditional setup (with all the modules?)
  • Template error for LockFile?
StephenKing
  • 36,187
  • 11
  • 83
  • 112
  • [This](http://askubuntu.com/questions/368515/upgraded-to-ubuntu-13-10-apache-not-able-to-start) might be related. Either setup mod_xml2enc or edit template to use Mutex instead of LockFile. – Hamid Nazari Feb 07 '14 at 01:07
  • if a solution @Hamid_Nazari pointed to doesn't work, please provide relevant part of the apache2.conf file. – Konzulic Feb 07 '14 at 14:24

3 Answers3

5

It looks like this might be a known issue with chef and the Apache2 recipe.

See the related tickets on the opscode issue tracker.

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

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

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

For now you could perhaps try installing version 2.2 of apache by overridding the attribute

default['apache']['package']
Jeremy Quinton
  • 688
  • 4
  • 13
3

I have found a temporary workaround for this, at leas until the cookbook gets updated.

Replace the following section in your config located in apache2/templates/apache2.conf.erb.

LockFile /var/lock/apache2/accept.lock

With this:

Mutex file:${APACHE_LOCK_DIR} default
jmreicha
  • 3,155
  • 7
  • 32
  • 39
  • You also want to remove **mod_authz_default** from **default_modules**: `default['apache']['default_modules'] = ['status', 'alias', 'auth_basic', 'authn_file', 'authz_groupfile', 'authz_host', 'authz_user', 'autoindex', 'dir', 'env', 'mime', 'negotiation', 'setenvif']` – suda Jul 16 '14 at 08:27
2

I had similar problems, and I just wanted to vagrant up my ubuntu/trusty64 with apache2 using chef-solo. Ubuntu 14 and Apache 2.4 to be precise.

It worked after:

  1. Following jmreicha's answer above
  2. Removing module "mod_authz_default" that got removed from 2.4 as of http://httpd.apache.org/docs/current/upgrading.html

It's a pity, I would assume that this basic configuration should work out-of-box. As mentioned above, migration from apache2.2 to apache2.4 is planned here: https://tickets.opscode.com/browse/COOK-3900

jkulak
  • 768
  • 1
  • 6
  • 18