Skip to content

Commit

Permalink
fix: nginx script
Browse files Browse the repository at this point in the history
  • Loading branch information
flying-sausages committed Aug 22, 2021
1 parent 6015bac commit 8b5d2b1
Showing 1 changed file with 12 additions and 33 deletions.
45 changes: 12 additions & 33 deletions scripts/nginx/lazylibrarian.sh
Original file line number Diff line number Diff line change
@@ -1,36 +1,15 @@
#!/bin/bash
# LazyLibrarian nginx script for swizzin
# Author: Aethaeran

##########################################################################
# Import Sources
##########################################################################

. /etc/swizzin/sources/functions/utils

##########################################################################
# Variables
##########################################################################

app_name="lazylibrarian"
pretty_name="LazyLibrarian"
nginx_conf="/etc/nginx/apps/$app_name.conf"

##########################################################################
# Main
##########################################################################

if [[ ! -e "$nginx_conf" ]]; then
cat > "$nginx_conf" << 'EOF'
location /lazylibrarian {
proxy_bind $server_addr;
proxy_pass http://127.0.0.1:5299;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Script-Name /lazylibrarian; # IMPORTANT: path has NO trailing slash
}
# Author: Aethaeran 2021
# GPLv3

cat > "/etc/nginx/apps/lazylibrarian.conf" << 'EOF'
location /lazylibrarian {
proxy_bind $server_addr;
proxy_pass http://127.0.0.1:5299;
proxy_set_header Host \$http_host;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header X-Scheme \$scheme;
proxy_set_header X-Script-Name /lazylibrarian; # IMPORTANT: path has NO trailing slash
}
EOF
else
echo_info "$pretty_name's nginx configuration already existed."
fi

0 comments on commit 8b5d2b1

Please sign in to comment.