0

We have a cloud-config script to do some work on a server right after creation. (Digital Ocean droplet)

I want the script to modify the default behavior for apache, setting the AllowOverride to All (default value is None) for the /var/www Directory.

To do this manually, I would simply change the apache config file (/etc/apache2/apache2.conf) to the value below.

<Directory /var/www/>
AllowOverride All

However, I want to make the change automatically somehow using cloud-config.

Is there a better way to do this?

(Note: I don't want to use the write_files directive simply overwrite the entire apache2.conf file with our own custom version for fear of forward incompatibility with future apache versions)

eric
  • 133
  • 5

1 Answers1

2

Assuming you don't want to use a full configuration management system like chef you could add this to the runcmd: list:

- sed -i '/<Directory \/var\/www\/>/ { N; N; s/AllowOverride None/AllowOverride All/ }' /etc/apache/sites-availabl/default

The problem is that these simple changes increase in number and complexity and in the end you should have used chef.

Mark Wagner
  • 17,764
  • 2
  • 30
  • 47