From fdb98cf7cbb90b49311a2ebfa915b213f2c4cd58 Mon Sep 17 00:00:00 2001 From: Romeo Papa Date: Thu, 24 Mar 2016 21:48:04 +0100 Subject: [PATCH] Template for serving through an .onion address. --- templates/web.onion.template.yml | 49 ++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 templates/web.onion.template.yml diff --git a/templates/web.onion.template.yml b/templates/web.onion.template.yml new file mode 100644 index 0000000..6323cf4 --- /dev/null +++ b/templates/web.onion.template.yml @@ -0,0 +1,49 @@ +# Adds another server on port 80 for hidden service hosting + +run: + - exec: + cmd: + # Check DISCOURSE_ONION variable has been configured + - if [ -z "$DISCOURSE_ONION" ]; then echo "DISCOURSE_ONION ENV variable is required and has not been set."; exit 1; fi + + - exec: + cmd: + # Copy default nginx file + - "cp $home/config/nginx.sample.conf /etc/nginx/conf.d/onion.conf" + + # Remove duplicate entries that would crash the server + - replace: + filename: "/etc/nginx/conf.d/onion.conf" + from: /upstream[^\}]+\}/m + to: "" + + - replace: + filename: "/etc/nginx/conf.d/onion.conf" + from: /map[^\}]+\}/m + to: "" + + - replace: + filename: "/etc/nginx/conf.d/onion.conf" + from: /types[^\}]+\}/m + to: "" + + - replace: + filename: "/etc/nginx/conf.d/onion.conf" + from: /proxy_cache_path.*$/ + to: "" + + - replace: + filename: "/etc/nginx/conf.d/onion.conf" + from: /log_format.*$/ + to: "" + + - replace: + filename: "/etc/nginx/conf.d/onion.conf" + from: /server_name.+$/ + to: server_name $$ENV_DISCOURSE_ONION; + + # Apply the same replacements done on web.template.yml to the nginx file + - replace: + filename: "/etc/nginx/conf.d/onion.conf" + from: /client_max_body_size.+$/ + to: client_max_body_size $upload_size ; -- 2.25.1