X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=nginx-site;h=f66b40c86b40db48d0601a287abe2f7dcecbaaa8;hb=3139f7f6b990e8ca3aa491078e3496dc97dc4c36;hp=43f1aa9d74b864493a7d7fcc296e3227c783265e;hpb=d8e7127346089f666eaff775cad4d2d0b40a6ec9;p=basic-https-conf diff --git a/nginx-site b/nginx-site index 43f1aa9..f66b40c 100755 --- a/nginx-site +++ b/nginx-site @@ -1,4 +1,4 @@ -#!/bin/bash -l +#!/bin/bash # Copyright (C) 2016 Ian Kelling # Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,47 +13,63 @@ # See the License for the specific language governing permissions and # limitations under the License. +[[ $EUID == 0 ]] || exec sudo -E "$BASH_SOURCE" "$@" + set -eE -o pipefail trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR usage() { cat </dev/null; then + http2_arg=http2 +fi + sudo dd of=/etc/nginx/sites-enabled/$h.conf <; EOF if [[ $extra_settings ]]; then @@ -115,15 +144,16 @@ if [[ $proxy_port ]]; then proxy_set_header X-Real-IP \$remote_addr; proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Ssl on; - proxy_set_header X-Forwarded-Port 443; + proxy_set_header X-Forwarded-Port $port; proxy_pass http://127.0.0.1:$proxy_port; } EOF +fi sudo tee -a /etc/nginx/sites-enabled/$h.conf <