[buildout]
parts = apache-instance

[configuration]
httpd_port = 8181
#httpd_host = 127.0.0.1
httpd_datadir = ${buildout:var-directory}/httpd
httpd_htdocs = ${:httpd_datadir}/htdocs
httpd_cgibin = ${:httpd_datadir}/cgi-bin

[apache-httpd]
recipe = collective.recipe.template
input = ${software_definition:software_home}/templates/httpd.in
output = ${buildout:data-bin-directory}/httpd
config-path = ${apache-conf:output}

[apache-conf]
recipe = collective.recipe.template
input = ${software_definition:software_home}/templates/httpd.conf.in
output = ${buildout:var-directory}/etc/httpd.conf

[apache-instance]
depends =
  ${create-directories:command}
  ${apache-httpd:output}
  ${apache-conf:output}

recipe = plone.recipe.command
command =
    mkdir -p ${configuration:httpd_htdocs}
    mkdir -p ${configuration:httpd_cgibin}
    mkdir -p ${buildout:log-directory}/httpd
    [ -f ${configuration:httpd_htdocs}/index.html ] || echo "<html><body><h1>It works!</h1></body></html>" > ${configuration:httpd_htdocs}/index.html

update-command = ${:command}