X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=nginx-site;h=2869e44a87e2980a1ecfcc4f2a4ffa259b238c78;hb=8d1ae39c659072b6407e913ac8a4df998f2c159a;hp=43f1aa9d74b864493a7d7fcc296e3227c783265e;hpb=d8e7127346089f666eaff775cad4d2d0b40a6ec9;p=basic-https-conf diff --git a/nginx-site b/nginx-site index 43f1aa9..2869e44 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,62 @@ # 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 + +echo "$0: creating /etc/nginx/sites-enabled/$h.conf" +cat >/etc/nginx/sites-enabled/$h.conf <; EOF if [[ $extra_settings ]]; then - cat $extra_settings | sudo tee -a /etc/nginx/sites-enabled/$h.conf + cat $extra_settings >>/etc/nginx/sites-enabled/$h.conf fi -if [[ $proxy_port ]]; then - sudo tee -a /etc/nginx/sites-enabled/$h.conf <>/etc/nginx/sites-enabled/$h.conf <>/etc/nginx/sites-enabled/$h.conf <