ngxproxy: add webroot support

This commit is contained in:
Wonderfall 2016-05-30 14:38:08 +02:00
parent fe8c943b7e
commit c62c45db31
3 changed files with 12 additions and 5 deletions

View File

@ -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>|$CERTIFICATE_PATH|g" \
-e "s|<KEY_PATH>|$KEY_PATH|g" \
@ -93,6 +99,7 @@ sed -i \
-e "s|<DOMAIN>|$DOMAIN|g" \
-e "s|<CONTAINER>|$CONTAINER|g" \
-e "s|<PORT>|$PORT|g" \
-e "s|<WEBROOT>|$WEBROOT|g" \
/sites-enabled/$NAME.conf
echo ""

View File

@ -4,7 +4,7 @@ server {
client_max_body_size <MAX_BODY_SIZE>M;
location / {
location <WEBROOT> {
proxy_pass http://<CONTAINER>:<PORT>;
include /etc/nginx/conf/proxy_params;
}

View File

@ -16,7 +16,7 @@ server {
client_max_body_size <MAX_BODY_SIZE>M;
location / {
location <WEBROOT> {
proxy_pass http://<CONTAINER>:<PORT>;
include /etc/nginx/conf/proxy_params;
}