X-Git-Url: https://iankelling.org/git/?p=basic-https-conf;a=blobdiff_plain;f=nginx-site;h=addd1d4a277740f60e683f1d5be529844ab72be9;hp=9ddb7766acb02f1b73f1abd37d9b5e56b5193b7b;hb=79707a58470ef41c8b1f07d1b9fb5b4cbfe46c6c;hpb=bcdbffa4898135bc42772e1b9b706dc2acadfbdd diff --git a/nginx-site b/nginx-site index 9ddb776..addd1d4 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 <