From: Romeo Papa Date: Thu, 24 Mar 2016 20:48:04 +0000 (+0100) Subject: Template for serving through an .onion address. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=fdb98cf7cbb90b49311a2ebfa915b213f2c4cd58;p=discourse_docker.git Template for serving through an .onion address. --- 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 ;