-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathapache-upgrade.sh
180 lines (134 loc) · 4.96 KB
/
apache-upgrade.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
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
#!/bin/bash
# CWP Apache 2.4 and suPHP 0.72 Upgrade Script
# Simple Bash script by Bullten Web Hosting Solutions [http://www.bullten.com]
CDIR='/tmp/apache-upgrade'
apache='/usr/local/apache/conf/httpd.conf'
vhost='/usr/local/apache/conf.d/vhosts.conf'
SOURCE_URL='http://dl-package.bullten.in/cwp/files'
packageHTTPD='httpd-2.4.12.tar.gz'
packageAPR='apr-1.5.1.tar.gz'
packageAPRUTIL='apr-util-1.5.4.tar.gz'
packageSUPHP='suphp-0.7.2.tar.gz'
RED='\033[01;31m'
RESET='\033[0m'
GREEN='\033[01;32m'
clear
echo -e "$GREEN******************************************************************************$RESET"
echo -e " Apache 2.4 and suPHP 0.7.2 Installation in CWP $RESET"
echo -e " Bullten Web Hosting Solutions http://www.bullten.com/"
echo -e " Web Hosting Company Specialized in Providing Managed VPS and Dedicated Server "
echo -e "$GREEN******************************************************************************$RESET"
echo " "
echo " "
echo -e $RED"This script will Install Apache 2.4 and suPHP 0.7.2"$RESET
echo -e $RED""
echo -n "Press ENTER to start the installation ...."
read option
rm -rf $CDIR; mkdir -p $CDIR
clear
echo -e $RED"Installing Apr 1.5.1"$RESET
echo -e $RED""$RESET
sleep 2
cd $CDIR
wget -c $SOURCE_URL/$packageAPR
tar zxvf $packageAPR
cd apr-1.5.1
./configure
make && make install
echo -e $RED"Apr 1.5.1 installation Completed."$RESET
echo -e $RED""$RESET
echo -e $RED"Apr-Util 1.5.4 installation will begin in 5 seconds.."$RESET
sleep 5
clear
echo -e $RED"Installing Apr-Util 1.5.4"$RESET
echo -e $RED""$RESET
sleep 2
cd $CDIR
wget -c $SOURCE_URL/$packageAPRUTIL
tar zxvf $packageAPRUTIL
cd apr-util-1.5.4
./configure --with-apr=/usr/local/apr/
make && make install
echo -e $RED"Apr-Util 1.5.4 installation Completed."$RESET
echo -e $RED""$RESET
echo -e $RED"Apache 2.4.12 installation will begin in 5 seconds.."$RESET
sleep 5
clear
echo -e $RED"Installing Apache 2.4.12 "$RESET
echo -e $RED""$RESET
sleep 2
cd $CDIR
wget -c $SOURCE_URL/$packageHTTPD
tar zxvf $packageHTTPD
cd httpd-2.4.12
rm -rf $apache
./configure --enable-so --prefix=/usr/local/apache --enable-ssl --enable-unique-id --enable-ssl=/usr/include/openssl --enable-rewrite --enable-deflate --enable-suexec --with-suexec-docroot="/home" --with-suexec-caller="nobody" --with-suexec-logfile="/usr/local/apache/logs/suexec_log" --enable-asis --enable-filter --with-pcre --with-apr=/usr/local/apr --with-mpm=prefork --with-apr-util=/usr/local/apr --enable-headers --enable-expires --enable-proxy
make && make install
if [ -e "/usr/local/apache/conf/httpd.conf" ];then
echo "Include /usr/local/apache/conf/sharedip.conf" >> $apache
echo "Include /usr/local/apache/conf.d/*.conf" >> $apache
echo "ExtendedStatus On" >> $apache
sed -i "s|DirectoryIndex index.html|DirectoryIndex index.php index.html|g" $apache
cat >> $apache <<EOF
<Directory "/usr/local/apache/htdocs">
suPHP_UserGroup nobody nobody
</Directory>
EOF
else
echo -e $RED"Apache installation failed. Cannot determine httpd.conf in /usr/local/apache/conf/ "$RESET
echo ""
echo -e $RED"Terminating installation / Installation Failed"$RESET
exit
fi
echo -e $RED"Apache 2.4.12 installation Completed."$RESET
echo -e $RED""$RESET
echo -e $RED"suPHP 0.7.2 installation will begin in 5 seconds.."$RESET
sleep 5
clear
echo -e $RED"Installing suPHP 0.7.2"$RESET
echo -e $RED""$RESET
sleep 2
cd $CDIR
wget -c $SOURCE_URL/$packageSUPHP
tar zxvf $packageSUPHP
cd suphp-0.7.2
yum install autoconf automake libtool -y
perl -pi -e 's/AM_CONFIG_HEADER/AC_CONFIG_HEADERS/' configure.ac
aclocal
libtoolize --force
automake --add-missing
autoreconf
perl -pi -e 's#"\$major_version" = "2.2"#"\$major_version" = "2.4"#' ./configure
./configure --with-apr=/usr/local/apr/ --with-apxs=/usr/local/apache/bin/apxs --with-setid-mode=paranoid --with-apache-user=nobody --with-gnu-ld --disable-checkpath
make && make install
sed -i "s|User daemon|User nobody|g" $apache
sed -i "s|Group daemon|Group nobody|g" $apache
sed -i "s|.*modules/libphp5.so.*||g" $apache
sed -i "s|.*httpd-userdir.conf.*|Include conf/extra/httpd-userdir.conf|" $apache
sed -i '/mod_userdir.so/s/^#//g' $apache
sed -i '/mod_rewrite.so/s/^#//g' $apache
sed -i '/mod_slotmem_shm.so/s/^#//g' $apache
sed -i '/mod_lbmethod_heartbeat.so/s/^/#/g' $apache
echo -e $RED"suPHP 0.7.2 installation Completed."$RESET
echo -e $RED""$RESET
echo -e $RED"Waiting for 5 Seconds..."$RESET
sleep 5
clear
if [ -e "/usr/local/apache/conf.d/vhosts.conf" ];then
echo -e $RED"Setting Vhost /usr/local/apache/conf.d/vhosts.conf "$RESET
sleep 2
sed -i '/Require all granted/d' $vhost
sed -i '/AllowOverride All/a \ \ \ \ \ \ \ \ Require all granted ' $vhost
echo -e $RED"Vhost Setup Completed"$RESET
else
echo -e $RED"Virtual Host Setup Failed. Please verify if vhosts.conf exist in /usr/local/apache/conf.d/ "$RESET
echo ""
echo -e $RED"Terminating installation / Installation Failed"$RESET
exit
fi
sleep 2
echo -e $RED"Restarting Apache"$RESET
service httpd restart
chkconfig httpd on
sleep 2
echo -e $RED"Installation Completed"$RESET