-
Notifications
You must be signed in to change notification settings - Fork 3
/
install.sh
executable file
·57 lines (46 loc) · 1012 Bytes
/
install.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
#!/bin/bash
root=/apps/openresty
if [ $# != 1 ] ; then
echo "USAGE: $0 dir"
echo " e.g.: $0 /apps/openresty"
exit 1;
else
root=$1
fi
cd `dirname $0`
./openresty-depends.sh
cd -
dir=$root/nginx/conf/httptables
if [ ! -x "$dir" ]; then
OLD=`pwd`
cd /tmp/
wget https://openresty.org/download/openresty-1.9.15.1.tar.gz
tar zxvf openresty-1.9.15.1.tar.gz
cd openresty-1.9.15.1/
./configure --prefix=$root --with-http_realip_module
gmake
gmake install
cd $OLD
mkdir $dir
fi
cat>startup.sh<<EOF
#!/bin/bash
cd $root/nginx/
sbin/nginx -c conf/nginx.conf
cd -
EOF
chmod +x startup.sh
cat>restart.sh<<EOF
#!/bin/bash
cd $root/nginx/
sbin/nginx -t && sbin/nginx -s reload
cd -
EOF
chmod +x restart.sh
/bin/cp -rf lua $dir
/bin/cp -rf httptables.conf $dir
/bin/cp -f restart.sh $root/nginx/sbin/
/bin/cp -f startup.sh $root/nginx/sbin/
/bin/cp -f nginx.conf $root/nginx/conf/
echo "install to $dir: ok"
echo "run $root/nginx/sbin/startup.sh to start"