diff --git a/apache-hosts/gamestats.gs.nintendowifi.net b/apache-hosts/gamestats.gs.nintendowifi.net new file mode 100644 index 0000000..dc67950 --- /dev/null +++ b/apache-hosts/gamestats.gs.nintendowifi.net @@ -0,0 +1,8 @@ + + ServerAdmin webmaster@localhost + ServerName gamestats.gs.nintendowifi.net + ServerAlias "gamestats.gs.nintendowifi.net, gamestats.gs.nintendowifi.net" + ProxyPreserveHost On + ProxyPass / http://127.0.0.1:9002/ + ProxyPassReverse / http://127.0.0.1:9002/ + diff --git a/apache-hosts/gamestats2.gs.nintendowifi.net b/apache-hosts/gamestats2.gs.nintendowifi.net new file mode 100644 index 0000000..3f79350 --- /dev/null +++ b/apache-hosts/gamestats2.gs.nintendowifi.net @@ -0,0 +1,10 @@ + + ServerAdmin webmaster@localhost + ServerName gamestats2.gs.nintendowifi.net + ServerAlias "gamestats2.gs.nintendowifi.net, gamestats2.gs.nintendowifi.net" + + ProxyPreserveHost On + + ProxyPass / http://127.0.0.1:9002/ + ProxyPassReverse / http://127.0.0.1:9002/ + diff --git a/apache-hosts/nas-naswii-dls1-conntest.nintendowifi.net b/apache-hosts/nas-naswii-dls1-conntest.nintendowifi.net new file mode 100644 index 0000000..f7f5537 --- /dev/null +++ b/apache-hosts/nas-naswii-dls1-conntest.nintendowifi.net @@ -0,0 +1,14 @@ + + ServerAdmin webmaster@localhost + ServerName naswii.nintendowifi.net + ServerAlias "naswii.nintendowifi.net, naswii.nintendowifi.net" + ServerAlias "nas.nintendowifi.net" + ServerAlias "nas.nintendowifi.net, nas.nintendowifi.net" + ServerAlias "dls1.nintendowifi.net" + ServerAlias "dls1.nintendowifi.net, dls1.nintendowifi.net" + ServerAlias "conntest.nintendowifi.net" + ServerAlias "conntest.nintendowifi.net, conntest.nintendowifi.net" + ProxyPreserveHost On + ProxyPass / http://127.0.0.1:9000/ + ProxyPassReverse / http://127.0.0.1:9000/ + diff --git a/apache-hosts/sake.gs.nintendowifi.net b/apache-hosts/sake.gs.nintendowifi.net new file mode 100644 index 0000000..ab854a6 --- /dev/null +++ b/apache-hosts/sake.gs.nintendowifi.net @@ -0,0 +1,11 @@ + + ServerAdmin webmaster@localhost + ServerName sake.gs.nintendowifi.net + ServerAlias sake.gs.nintendowifi.net *.sake.gs.nintendowifi.net + ServerAlias secure.sake.gs.nintendowifi.net + ServerAlias secure.sake.gs.nintendowifi.net *.secure.sake.gs.nintendowifi.net + + ProxyPass / http://127.0.0.1:8000/ + + CustomLog ${APACHE_LOG_DIR}/access.log combined + diff --git a/server-setup.sh b/server-setup.sh new file mode 100644 index 0000000..b97bd6f --- /dev/null +++ b/server-setup.sh @@ -0,0 +1,97 @@ +#!/bin/bash +#Variables used by the script in various sections to pre-fill long commandds +ROOT_UID="0" +apache="/etc/apache2/sites-available" #This is the directory where sites are kept in case they need to be disabled in Apache +vh="./apache-hosts" #This folder is in the root directory of this script and is required for it to copy the files over +vh1="gamestats2.gs.nintendowifi.net" #This is the first virtual host file +vh2="gamestats.gs.nintendowifi.net" #This is the second virtual host file +vh3="nas-naswii-dls1-conntest.nintendowifi.net" #This is the third virtual host file +vh4="sake.gs.nintendowifi.net" #This is the fourth virtual host file +mod1="proxy.conf" #This is a proxy mod that is dependent on the other 2 +mod2="proxy_http.load" #This is related to mod1 +mod3="proxy.load" #This is related to mod1 and mod2 +mod4="proxy" #This is a fallback module for use with OS's that don't support mod1, mod2 or mod3 +cp="/etc/apache2/sites-enabled" #This is the directory where sites are usually enabled using a2enmod +fqdn="localhost" #This variable fixes the fqdn error in Apache +#Don't forget to install the git package before running this script +#Check if run as root +if [ "$UID" -ne "$ROOT_UID" ] ; then #if the user ID is not root... + echo "You must be root to do that!" #Tell the user they must be root + exit 1 #Exits with an error +fi #End of if statement + +echo "Hello and welcome to my installation script. I assume you're running this as root?" +sleep 5s #Pauses for 5 seconds +echo "Okay! Gotta love when a plan comes together!" +echo "Let me install a few upgrade and packages on your system for you...." +echo "If you already have a package installed, I'll simply skip over it or upgrade it" +apt-get update -y --fix-missing #Fixes missing apt-get repository errors on some Linux distributions +echo "Updated repo lists...." +echo "Installing package upgrades... go kill some time as this may take a few minutes..." +apt-get upgrade -y #Upgrades all already installed packages on your system +clear +echo "Upgrades complete!" +echo "Now installing required packages..." +apt-get install apache2 python2.7 python-twisted dnsmasq -y #Install required packages +echo "Installing Apache, Python 2.7, Python Twisted and DNSMasq....." +clear +echo "Now that that's out of the way, let's do some apache stuff" +echo "Copying virtual hosts to sites-available for virtual hosting of the server" +#The next several lines will copy the Nintendo virtual host files to sites-available in Apache's directory +cp ./$vh/$vh1 $apache/$vh1 +cp ./$vh/$vh2 $apache/$vh2 +cp ./$vh/$vh3 $apache/$vh3 +cp ./$vh/$vh4 $apache/$vh4 +sleep 5s +echo "Copying virtual hosts to sites-enabled for virtual hosting of the server" +cp ./$vh/$vh1 $cp/$vh1 +cp ./$vh/$vh2 $cp/$vh2 +cp ./$vh/$vh3 $cp/$vh3 +cp ./$vh/$vh4 $cp/$vh4 +sleep 5s +clear +echo "Okay! Lets hope nothing broke during this process..." +sleep 5s +echo "Now lets enable some modules so we can make all of this work..." +a2enmod $mod1 $mod2 $mod3 #Enables proxy modules +if [ $? != "0" ] ; then #If in the event these modules fail to activate.... + a2enmod $mod4 #Enable proxy fallback module +fi +echo "Great! Everything appears to be set up as far as Apache" +echo "Fixing that nagging Apache FQDN error...." +cat >>/etc/apache2/apache2.conf <>/etc/dnsmasq.conf < ./adminpageconf.json <