uptime is the game, downtime is the name

Trotz meines dummen Servers lege ich hin und wieder mal eine Webseite drauf. Sehr nervig darum habe ich mal ein kleines Script gebastelt was mir das total vereinfacht.

Hier das Script:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh
# New Vhost
echo Creating a new Vhost for $1
cp /etc/apache2/sites-available/dummy /etc/apache2/sites-available/$1
ln -s /etc/apache2/sites-available/$1 /etc/apache2/sites-enabled/$1
cd /etc/apache2/sites-available/
for fl in $1; do
mv $fl $fl.old
sed s/X1/$1/g $fl.old > $fl
rm -f $fl.old
mkdir /var/www/$1
mkdir /var/www/$1/htdocs
chown -R dennis.www-data /var/www/$1
#Apache neustarten
#/etc/init.d/apache2 restart
done

und der dummy(/etc/apache2/sites-available/dummy) VHost:

[code lang="apache"]
NameVirtualHost *

ServerAdmin root@mail.tld
DocumentRoot /var/www/X1/htdocs

ServerName X1
ServerAlias www.X1 *.X1

CustomLog /var/log/apache2/access.log combined

Options +Indexes +Includes +FollowSymLinks
AllowOverride All



[/code]

Pfade gegebenfalls anpassen

Benutzt wird es wie folgt.
erstmal

1
nano newvhost

dort das dann reinkopieren und speichern.
Jetzt nur noch einmal

1
chmod +x newvhost

und anschließend kann man mit

1
 ./newvhost domain.tld

eine neue Domain anlegen.

Ausgezeichnet!

Keine Kommentare
Post a comment