add internal domains

This commit is contained in:
2015-06-24 12:45:37 +03:00
parent 7194e0a172
commit 2ff35e89c8
2 changed files with 11 additions and 6 deletions

View File

@@ -3,6 +3,7 @@
# echo "* * * * * root /root/scripts/server/list-web-users.sh" > /etc/cron.d/list-web-users
DOMAINROOT="mit.tareo-tz.org"
INTDOMAINROOT="web.intra"
WEBDIR="/var/www/html/html"
> $WEBDIR/websites.txt
@@ -11,8 +12,9 @@ find /var/www/* -maxdepth 0 -type d -print0 | while IFS= read -r -d $'\0' line;
USER=$(basename $line)
DOMAIN="$USER.$DOMAINROOT"
INTDOMAIN="$USER.$INTDOMAINROOT"
if [ ! "$USER" == "html" ] && [ ! "$USER" == "pma" ]; then
echo "<li><a href=\"http://$DOMAIN\">$DOMAIN</a></li>" >> $WEBDIR/websites.txt
echo "<li><a href=\"http://$INTDOMAIN\">$INTDOMAIN</a> (alternatively <a href=\"http://$DOMAIN\">$DOMAIN</a>)</li>" >> $WEBDIR/websites.txt
fi
done

View File

@@ -1,6 +1,7 @@
#!/bin/bash
DOMAINROOT="mit.tareo-tz.org"
INTDOMAINROOT="web.intra"
WEBROOT="/var/www"
DATASHEETS="/root/datasheets"
@@ -22,10 +23,12 @@ fi
read -p "Password of $USER: " PASS
DOMAIN="$USER.$DOMAINROOT"
echo "The new user's domain will be $DOMAIN"
INTDOMAIN="$USER.$INTDOMAINROOT"
echo "The new user's domain will be $DOMAIN. The internal domain will be $INTDOMAIN"
read -p "Is that ok? [Y/n]" yn
if [ "$yn" == "n" ]; then
read -p "Type in custom domain: " DOMAIN
read -p "Type in custom internal domain: " INTDOMAIN
fi
WEBDIR="$WEBROOT/$USER"
@@ -97,7 +100,7 @@ echo "[INFO] Configuring Apache VirtualHost..."
cat > /etc/apache2/sites-available/$USER.conf << EOF
<VirtualHost *:80>
ServerAdmin info@tareo-tz.org
ServerName $USER.server.local
ServerName $INTDOMAIN
ServerAlias $DOMAIN
SuexecUserGroup $USER $USER
AddHandler fcgid-script .php
@@ -164,10 +167,10 @@ cat > $DATASHEETS/datasheet-$USER.txt << EOF
################################
# Webserver
URL: $DOMAIN
URL: $INTDOMAIN
# FTP (Use FileZilla)
Server: http://$DOMAIN
Server: http://$INTDOMAIN
Port: 22
Protocol: SFTP
Logon type: Normal
@@ -182,7 +185,7 @@ User Name: $USER
Password: $PASS
Database Host: localhost
phpMyAdmin: http://pma.$DOMAINROOT
phpMyAdmin: http://pma.$INTDOMAINROOT
EOF
enscript -p $DATASHEETS/datasheet-$USER.ps $DATASHEETS/datasheet-$USER.txt