diff --git a/software/apache-frontend/000.conf.in b/software/apache-frontend/000.conf.in new file mode 100644 index 0000000000000000000000000000000000000000..5bf9b9d9e268a830be64f323eb59ec268b136181 --- /dev/null +++ b/software/apache-frontend/000.conf.in @@ -0,0 +1,24 @@ +<VirtualHost *:{{ https_port }}> + ServerName www.example.org + SSLEngine on + SSLProxyEngine on + SSLProtocol -ALL +SSLv3 +TLSv1 + SSLHonorCipherOrder On + SSLCipherSuite RC4-SHA:HIGH:!ADH + + # Rewrite part + ProxyVia On + ProxyPreserveHost On + ProxyTimeout 600 + RewriteEngine On + + + ErrorDocument 404 /notfound.html + +</VirtualHost> + +<VirtualHost *:{{ http_port }}> + + ServerName www.example.org + ErrorDocument 404 /notfound.html +</VirtualHost> \ No newline at end of file diff --git a/software/apache-frontend/apache-slave-list.cfg.in b/software/apache-frontend/apache-slave-list.cfg.in index 3faae46978802a5b5429f9248939ffb784ca652f..79538680b03334ac5ba191ec204a902b844a7a82 100644 --- a/software/apache-frontend/apache-slave-list.cfg.in +++ b/software/apache-frontend/apache-slave-list.cfg.in @@ -15,6 +15,8 @@ context = {% set slave_section_title = 'dynamic-template-slave-instance-%s' % slave_reference -%} {% set slave_parameter_dict = generic_instance_parameter_dict.copy() -%} {% do part_list.append(slave_section_title) -%} +{% do slave_parameter_dict.__setitem__('access_log', '/'.join([apache_log_directory, '%s_access_log' % slave_reference])) -%} +{% do slave_parameter_dict.__setitem__('error_log', '/'.join([apache_log_directory, '%s_error_log' % slave_reference])) -%} [{{ slave_section_title }}] < = jinja2-template-base template = {{ template_slave_configuration }} diff --git a/software/apache-frontend/common.cfg b/software/apache-frontend/common.cfg index a10c8cdf2464ee70a2aadf825a9443e4db069533..002710949a0434bad7fb8c8e4a5ba70148750c5c 100644 --- a/software/apache-frontend/common.cfg +++ b/software/apache-frontend/common.cfg @@ -104,6 +104,17 @@ recipe = slapos.recipe.build:download url = ${:_profile_base_location_}/apache-yakari.cfg.in mode = 640 +[template-not-found-html] +recipe = slapos.recipe.build:download +url = ${:_profile_base_location_}/notfound.html +filename = notfound.html +mode = 640 + +[template-default-virtualhost] +recipe = slapos.recipe.build:download +url = ${:_profile_base_location_}/000.conf.in +mode = 640 + [template-empty] recipe = slapos.recipe.build:download url = ${:_profile_base_location_}/empty.in diff --git a/software/apache-frontend/instance.cfg b/software/apache-frontend/instance.cfg index 1b737e35609de6f037d25eee76cca82823f91ab3..9e759a55203676ace5d14a576f0e445387da791c 100644 --- a/software/apache-frontend/instance.cfg +++ b/software/apache-frontend/instance.cfg @@ -17,6 +17,8 @@ parts = frontend-apache-graceful cached-apache-graceful squid-reload + dynamic-template-default-vh + not-found-html promise-apache-frontend-v4-https promise-apache-frontend-v4-http promise-apache-frontend-v6-https @@ -89,6 +91,15 @@ context = key slapparameter_dict instance-parameter:configuration $${:extra-context} +[dynamic-template-default-vh] +< = jinja2-template-base +template = ${template-default-virtualhost:target} +rendered = $${apache-directory:slave-configuration}/000.conf +extensions = jinja2.ext.do +extra-context = + key http_port instance-parameter:configuration.plain_http_port + key https_port instance-parameter:configuration.port + [dynamic-template-slave-list] < = jinja2-template-base template = ${template-slave-list:target} @@ -101,6 +112,7 @@ extra-context = key slave_instance_list instance-parameter:slave-instance-list key rewrite_cached_configuration apache-configuration:cached-rewrite-file key custom_ssl_directory apache-directory:vh-ssl + key apache_log_directory apache-directory:slave-log raw empty_template ${template-empty:target} raw cache_access http://$${instance-parameter:ipv4-random}:$${apache-configuration:cache-port} raw template_slave_configuration ${template-slave-configuration:target} @@ -203,6 +215,12 @@ wait-for-files = $${ca-frontend:cert-file} $${ca-frontend:key-file} +[not-found-html] +recipe = slapos.cookbook:symbolic.link +target-directory = $${apache-directory:document-root} +link-binary = + ${template-not-found-html:target} + [apache-directory] recipe = slapos.cookbook:mkdirectory document-root = $${directory:srv}/htdocs @@ -210,6 +228,7 @@ slave-configuration = $${directory:srv}/apache-slave-conf.d/ cache = $${directory:var}/cache mod-ssl = $${:cache}/httpd_mod_ssl vh-ssl = $${:slave-configuration}/ssl +slave-log = $${directory:log}/httpd [apache-configuration] frontend-configuration = $${directory:etc}/apache_frontend.conf @@ -305,7 +324,7 @@ state-file = $${directory:srv}/logrotate.status <= logrotate recipe = slapos.cookbook:logrotate.d name = apache -log = $${apache-configuration:error-log} $${apache-configuration:access-log} +log = $${apache-directory:slave-log}/*_log $${apache-configuration:error-log} $${apache-configuration:access-log} frequency = daily rotatep-num = 30 post = ${buildout:bin-directory}/killpidfromfile $${apache-configuration:pid-file} SIGUSR1 diff --git a/software/apache-frontend/notfound.html b/software/apache-frontend/notfound.html new file mode 100644 index 0000000000000000000000000000000000000000..2e87e0a9bec1acebe77ad603c9023ce9f6b464f4 --- /dev/null +++ b/software/apache-frontend/notfound.html @@ -0,0 +1,9 @@ +<html> +<head> + <title>Instance not found</title> +</head> +<body> +<h1>This instance has not been found.</h1> +<p>If this error persists, please check your instance URL and status on SlapOS Master.</p> +</body> +</html>