From c62c45db31817cf17999e9e791fd87bf02cf4643 Mon Sep 17 00:00:00 2001 From: Wonderfall Date: Mon, 30 May 2016 14:38:08 +0200 Subject: [PATCH] ngxproxy: add webroot support --- boring-nginx/ngxproxy | 13 ++++++++++--- boring-nginx/vhost_http.conf | 2 +- boring-nginx/vhost_https.conf | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/boring-nginx/ngxproxy b/boring-nginx/ngxproxy index 49f8731..b4e2d8d 100644 --- a/boring-nginx/ngxproxy +++ b/boring-nginx/ngxproxy @@ -21,6 +21,12 @@ while [ "$DOMAIN" == "" ]; do fi done +read -p "Webroot (default is /) ": WEBROOT + +if [ "$WEBROOT" == "" ]; then + WEBROOT="/" +fi + while [ "$CONTAINER" == "" ]; do read -p "Container: " CONTAINER ping -c 1 $CONTAINER >/dev/null 2>&1 @@ -50,13 +56,13 @@ if [ "$HTTPS" == "y" ]; then while [ ! -f "$CERTIFICATE_PATH" ]; do read -p "Certificate path: " CERTIFICATE_PATH done - + while [ ! -f "$KEY_PATH" ]; do read -p "Certificate key path: " KEY_PATH done - + cp /etc/nginx/conf/vhost_https.conf /sites-enabled/${NAME}.conf - + sed -i \ -e "s||$CERTIFICATE_PATH|g" \ -e "s||$KEY_PATH|g" \ @@ -93,6 +99,7 @@ sed -i \ -e "s||$DOMAIN|g" \ -e "s||$CONTAINER|g" \ -e "s||$PORT|g" \ + -e "s||$WEBROOT|g" \ /sites-enabled/$NAME.conf echo "" diff --git a/boring-nginx/vhost_http.conf b/boring-nginx/vhost_http.conf index 63a7bce..72a5be0 100644 --- a/boring-nginx/vhost_http.conf +++ b/boring-nginx/vhost_http.conf @@ -4,7 +4,7 @@ server { client_max_body_size M; - location / { + location { proxy_pass http://:; include /etc/nginx/conf/proxy_params; } diff --git a/boring-nginx/vhost_https.conf b/boring-nginx/vhost_https.conf index 5256e73..382148b 100644 --- a/boring-nginx/vhost_https.conf +++ b/boring-nginx/vhost_https.conf @@ -16,7 +16,7 @@ server { client_max_body_size M; - location / { + location { proxy_pass http://:; include /etc/nginx/conf/proxy_params; }