mirror of
https://github.com/hoellen/dockerfiles.git
synced 2025-04-20 04:19:18 +00:00
update ngxpasswd and ngxproxy
This commit is contained in:
parent
a1cc861066
commit
fd9239b4eb
@ -1,9 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo ""
|
||||
echo
|
||||
echo "Welcome to ngxpasswd utility."
|
||||
echo "We're about to create a password file."
|
||||
echo ""
|
||||
echo
|
||||
|
||||
cd /passwds || exit 1
|
||||
|
||||
@ -46,8 +46,7 @@ if [ -f "/sites-enabled/$NAME.conf" ]; then
|
||||
|
||||
if [ "$ADD" == "y" ]; then
|
||||
cd /etc/nginx/conf
|
||||
sed -i "/location/r vhost_passwd.conf" /sites-enabled/$NAME.conf
|
||||
sed -i "s/<NAME>/$NAME/g" /sites-enabled/$NAME.conf
|
||||
sed -i -e 's/#auth/auth/g' -e "s/<NAME>/$NAME/g" /sites-enabled/$NAME.conf
|
||||
echo "Automatically added, please verify. Otherwise follow these instructions."
|
||||
echo
|
||||
fi
|
||||
|
@ -1,9 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo ""
|
||||
echo
|
||||
echo "Welcome to ngxproxy utility."
|
||||
echo "We're about to create a new vhost."
|
||||
echo ""
|
||||
echo
|
||||
|
||||
while [ "$NAME" == "" ]; do
|
||||
read -p "Name: " NAME
|
||||
@ -27,11 +27,11 @@ if [ "$WEBROOT" == "" ]; then
|
||||
WEBROOT="/"
|
||||
else
|
||||
echo "WARNING: Depending on the app, you might have to add a proxy header to get your custom webroot working."
|
||||
|
||||
|
||||
while [[ "$CONFIGURE_WEBROOT" != "y" && "$CONFIGURE_WEBROOT" != "n" ]]; do
|
||||
read -p "Is it required to configure it? [y/n]: " CONFIGURE_WEBROOT
|
||||
done
|
||||
|
||||
|
||||
if [ "$CONFIGURE_WEBROOT" == "y" ]; then
|
||||
while [ "$WEBROOT_HEADER" == "" ]; do
|
||||
read -p "Type the required proxy_set_header (something like X-Script-Name): " WEBROOT_HEADER
|
||||
@ -102,9 +102,7 @@ while [ "$MAX_BODY_SIZE" == "" ]; do
|
||||
done
|
||||
|
||||
if [ "$MAX_BODY_SIZE" != "n" ]; then
|
||||
sed -i "s|<MAX_BODY_SIZE>|$MAX_BODY_SIZE|g" /sites-enabled/$NAME.conf
|
||||
else
|
||||
sed -i '/client_max_body_size/d' /sites-enabled/$NAME.conf
|
||||
sed -i "s|#client_max_body_size <MAX_BODY_SIZE>|client_max_body_size $MAX_BODY_SIZE|g" /sites-enabled/$NAME.conf
|
||||
fi
|
||||
|
||||
if [ "$CONFIGURE_WEBROOT" == "y" ]; then
|
||||
@ -118,7 +116,7 @@ sed -i \
|
||||
-e "s|<WEBROOT>|$WEBROOT|g" \
|
||||
/sites-enabled/$NAME.conf
|
||||
|
||||
echo ""
|
||||
echo
|
||||
echo "It's done : $NAME.conf has been generated."
|
||||
|
||||
while [[ "$RELOAD" != "y" && "$RELOAD" != "n" ]]; do
|
||||
@ -132,5 +130,5 @@ else
|
||||
echo "Restart manually nginx to enable this new vhost."
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo
|
||||
exit 0
|
||||
|
@ -2,7 +2,10 @@ server {
|
||||
listen 8000;
|
||||
server_name <DOMAIN>;
|
||||
|
||||
client_max_body_size <MAX_BODY_SIZE>M;
|
||||
#client_max_body_size <MAX_BODY_SIZE>M;
|
||||
|
||||
#auth_basic "Who's this?";
|
||||
#auth_basic_user_file /passwds/<NAME>.htpasswd;
|
||||
|
||||
location <WEBROOT> {
|
||||
proxy_pass http://<CONTAINER>:<PORT>;
|
||||
|
@ -14,7 +14,10 @@ server {
|
||||
include /conf.d/ssl_params.conf;
|
||||
include /etc/nginx/conf/headers_params;
|
||||
|
||||
client_max_body_size <MAX_BODY_SIZE>M;
|
||||
#client_max_body_size <MAX_BODY_SIZE>M;
|
||||
|
||||
#auth_basic "Who's this?";
|
||||
#auth_basic_user_file /passwds/<NAME>.htpasswd;
|
||||
|
||||
location <WEBROOT> {
|
||||
proxy_pass http://<CONTAINER>:<PORT>;
|
||||
|
@ -1,2 +0,0 @@
|
||||
auth_basic "Who's this?";
|
||||
auth_basic_user_file /passwds/<NAME>.htpasswd;
|
Loading…
x
Reference in New Issue
Block a user