-
Notifications
You must be signed in to change notification settings - Fork 3
/
lighttpd_setup
executable file
·75 lines (63 loc) · 1.84 KB
/
lighttpd_setup
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
if [ $UID -ne 0 ]; then
echo "You must be root to run this!"
exit
fi
### Warning!!! Don't use leading spaces rather than leading tabs in "Here Documents" ###
# Find out where files are located
source config
if [ "${GEMSTONE_CONFIG}x" = "x" ] ; then
source $GS_HOME/gemstone/stones/$GS_STONE/defStone.env $GS_STONE
else
source $GEMSTONE_CONFIG
fi
echo "`basename $0` creates and installs lighttpd configuration files for GLASS."
echo "WARNING: It will overwrite /etc/lighttpd/conf-available/10-GLASS.conf"
echo "and /etc/lighttpd/lighttpd.conf"
echo "Shall I continue? (Y/N)"
read cont
case "$cont" in
y|Y|yes)
;;
*)
echo "Not continuing"
exit
;;
esac
# Stop lighttpd
/etc/init.d/lighttpd stop
# Just in case dir isn't there already
mkdir -p /etc/lighttpd/conf-available/
# Copy a default lighttpd.conf file
cp etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf
# Create GLASS lighttpd config file beginning part
cat > /etc/lighttpd/conf-available/10-GLASS.conf <<-EOF
# Automatically generated GLASS configuration file
server.modules += ( "mod_fastcgi" )
server.modules += ( "mod_rewrite" )
server.document-root = "$WWW_DOCROOT"
fastcgi.debug = 1
fastcgi.server = (
"/" =>
(
EOF
#
# Create GLASS lighttpd config file middle part for port assignments
for i in `seq $STARTING_PORT $ENDING_PORT` ; do
cat >> /etc/lighttpd/conf-available/10-GLASS.conf <<-EOF
("host" => "127.0.0.1","port" => $i,"check-local" =>
"disable","mode" => "responder" ),
EOF
done
#
# Create GLASS lighttpd config file ending part
cat >> /etc/lighttpd/conf-available/10-GLASS.conf <<-EOF
),
)
EOF
# Make sure 10-GLASS is enabled
ln -s /etc/lighttpd/conf-available/10-GLASS.conf /etc/lighttpd/conf-enabled/10-GLASS.conf
# Restart lighttpd
/etc/init.d/lighttpd restart
# Success
exit 0