update ngxpasswd and ngxproxy

This commit is contained in:
Wonderfall 2016-05-30 18:10:49 +02:00
parent a1cc861066
commit fd9239b4eb
5 changed files with 18 additions and 17 deletions

View File

@ -1,9 +1,9 @@
#!/bin/sh #!/bin/sh
echo "" echo
echo "Welcome to ngxpasswd utility." echo "Welcome to ngxpasswd utility."
echo "We're about to create a password file." echo "We're about to create a password file."
echo "" echo
cd /passwds || exit 1 cd /passwds || exit 1
@ -46,8 +46,7 @@ if [ -f "/sites-enabled/$NAME.conf" ]; then
if [ "$ADD" == "y" ]; then if [ "$ADD" == "y" ]; then
cd /etc/nginx/conf cd /etc/nginx/conf
sed -i "/location/r vhost_passwd.conf" /sites-enabled/$NAME.conf sed -i -e 's/#auth/auth/g' -e "s/<NAME>/$NAME/g" /sites-enabled/$NAME.conf
sed -i "s/<NAME>/$NAME/g" /sites-enabled/$NAME.conf
echo "Automatically added, please verify. Otherwise follow these instructions." echo "Automatically added, please verify. Otherwise follow these instructions."
echo echo
fi fi

View File

@ -1,9 +1,9 @@
#!/bin/sh #!/bin/sh
echo "" echo
echo "Welcome to ngxproxy utility." echo "Welcome to ngxproxy utility."
echo "We're about to create a new vhost." echo "We're about to create a new vhost."
echo "" echo
while [ "$NAME" == "" ]; do while [ "$NAME" == "" ]; do
read -p "Name: " NAME read -p "Name: " NAME
@ -27,11 +27,11 @@ if [ "$WEBROOT" == "" ]; then
WEBROOT="/" WEBROOT="/"
else else
echo "WARNING: Depending on the app, you might have to add a proxy header to get your custom webroot working." 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 while [[ "$CONFIGURE_WEBROOT" != "y" && "$CONFIGURE_WEBROOT" != "n" ]]; do
read -p "Is it required to configure it? [y/n]: " CONFIGURE_WEBROOT read -p "Is it required to configure it? [y/n]: " CONFIGURE_WEBROOT
done done
if [ "$CONFIGURE_WEBROOT" == "y" ]; then if [ "$CONFIGURE_WEBROOT" == "y" ]; then
while [ "$WEBROOT_HEADER" == "" ]; do while [ "$WEBROOT_HEADER" == "" ]; do
read -p "Type the required proxy_set_header (something like X-Script-Name): " WEBROOT_HEADER 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 done
if [ "$MAX_BODY_SIZE" != "n" ]; then if [ "$MAX_BODY_SIZE" != "n" ]; then
sed -i "s|<MAX_BODY_SIZE>|$MAX_BODY_SIZE|g" /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
else
sed -i '/client_max_body_size/d' /sites-enabled/$NAME.conf
fi fi
if [ "$CONFIGURE_WEBROOT" == "y" ]; then if [ "$CONFIGURE_WEBROOT" == "y" ]; then
@ -118,7 +116,7 @@ sed -i \
-e "s|<WEBROOT>|$WEBROOT|g" \ -e "s|<WEBROOT>|$WEBROOT|g" \
/sites-enabled/$NAME.conf /sites-enabled/$NAME.conf
echo "" echo
echo "It's done : $NAME.conf has been generated." echo "It's done : $NAME.conf has been generated."
while [[ "$RELOAD" != "y" && "$RELOAD" != "n" ]]; do while [[ "$RELOAD" != "y" && "$RELOAD" != "n" ]]; do
@ -132,5 +130,5 @@ else
echo "Restart manually nginx to enable this new vhost." echo "Restart manually nginx to enable this new vhost."
fi fi
echo "" echo
exit 0 exit 0

View File

@ -2,7 +2,10 @@ server {
listen 8000; listen 8000;
server_name <DOMAIN>; 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> { location <WEBROOT> {
proxy_pass http://<CONTAINER>:<PORT>; proxy_pass http://<CONTAINER>:<PORT>;

View File

@ -14,7 +14,10 @@ server {
include /conf.d/ssl_params.conf; include /conf.d/ssl_params.conf;
include /etc/nginx/conf/headers_params; 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> { location <WEBROOT> {
proxy_pass http://<CONTAINER>:<PORT>; proxy_pass http://<CONTAINER>:<PORT>;

View File

@ -1,2 +0,0 @@
auth_basic "Who's this?";
auth_basic_user_file /passwds/<NAME>.htpasswd;