Custom bits in Apache SSL template


I really want to be able to add sections to some sites’ apache .conf files.

The obvious way to do that seems to be to include a bit in the ssl.template.erb that says something like

IncludeOptional /<%=domain_directory%>/config/apacheopts/*/conf

But for reasons I can’t understand, that doesn’t seem to work.

Is there a better way to have custom snippets in a config file but still have it update for letsencrypt automatically?


That line seems okay, as long as the config/apacheopts directory does exist (Symbiosis will complain about No such file or directory when you try to run symbiosis-httpd-configure -v otherwise)

A slightly more complex alternative is to remove /etc/cron.hourly/symbiosis-httpd-configure and have your own custom cron. For example, I might have a /etc/cron.hourly/php-version script to use a different template for one of my websites:

symbiosis-httpd-configure --no-reload
symbiosis-httpd-configure --force -v --ssl-template /etc/symbiosis/apache.d/php7.2.ssl.template.erb --non-ssl-template /etc/symbiosis/apache.d/php7.2.non_ssl.template.erb --no-reload
/etc/init.d/apache2 reload

This mostly comes in handy when you have multiple sites which all need different templates, if you’re running loads of different versions of PHP for example.