-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.sh
executable file
·50 lines (40 loc) · 972 Bytes
/
main.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
if [ -z "$SITE" ]
then
echo 'Prease inform an SITE variable, using default'
SITE=localhost
fi
if [ -z "$ADMIN_EMAIL" ]
then
echo 'Please inform an admin email, using default'
ADMIN_EMAIL='root@localhost'
fi
if [ ! -f /etc/apache2/sites-enabled/000-default.conf ]
then
echo '[+] Generating site configuration'
cat > /etc/apache2/sites-enabled/000-default.conf << EOF
<VirtualHost *:80>
ServerName ${SITE}
ServerAdmin ${ADMIN_EMAIL}
DocumentRoot /www
<Directory /www>
Options -Indexes
AllowOverride all
Require all granted
</Directory>
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
ErrorLog /dev/stderr
TransferLog /dev/stdout
</VirtualHost>
EOF
fi
# Set apache variables
source /etc/apache2/envvars
apachectl -f /etc/apache2/apache2.conf
while [ true ]
do
tail -f /var/log/apache2/*.log
sleep 10
done;