From eb0824640239a245d2598013d2a8ee442e5b3631 Mon Sep 17 00:00:00 2001 From: vala Date: Fri, 10 May 2019 16:06:16 -0400 Subject: [PATCH] Upload files to '' --- auto-nginx | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 auto-nginx diff --git a/auto-nginx b/auto-nginx new file mode 100644 index 0000000..d3de736 --- /dev/null +++ b/auto-nginx @@ -0,0 +1,61 @@ +#!/bin/bash + +############################################################################### +# auto-nginx - for setting up a simple nginx config for further tweaking +# a project by vala +# +# kopimi (k) 2019 - vala +# +# // this is a work in progress, so any constructive input is welcome. // +# +# auto-nginx [option] [argument] ... +# +# +############################################################################### + +set -e # exit as soon as a line in the bash script fails +# set -x # prints each command executed (prefix with ++) +# set -ex # both the above + +echo "auto-nginx" +echo -n "a simple script to generate a fully functional nginx site." + +sudo -n true +test $? -eq 0 || exit 1 "for this script to be able to create an nginx configuration file, you must run this as root." + +echo + +# asks for domain.tld and insert it into the generated file at given points +echo "what is the name of your site (domain.tld or sub.domain.tld)?" +read domain +if (( $domain == true )) +then + echo -e "\nalright, let us setup an nginx configuration for $domain." +else + echo -e "\nyou cannot setup a nginx configuration without a domain." +fi + +# asks where the server is located on the machine +echo "where is the root folder of the webserver located?" +read webroot +if (( $webroot == true )) +then + echo "okay, $webroot is configured as rootfolder of the website" +else + read -p "since you didnt specify, i assume it is located in /var/www/$domain? [y/n]" loop +# asks what port the internal server is running at. +echo "what internal port is the server running on (usually something like 8096, 4000 or 9999)?" +read port +echo "alright, nginx will forward requests to server running at port $port." + +echo "do you want to add an ssl certificate, for higher site rankings and secure access to the website? " + +# asks for port on localhost, and sets it accordingly + +if [[ $domain =* ]] + echo +fi + +echo "the site at $domain, is running at 127.0.0.1:$port" + +exit