-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathentrypoint.sh
46 lines (36 loc) · 1.7 KB
/
entrypoint.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
#!/bin/sh
if [ -z "$USERSITE" ]; then
USERSITE=$SITEDOMAIN
fi
if [ -z "$USERLOCATION" ]; then
USERLOCATION=$SITELOCATION
fi
if [ -z "$USERHFCPORT" ]; then
USERHFCPORT=$HFCPORT
fi
USERSITE=$(echo $USERSITE | sed -e 's/[\/&]/\\&/g')
USERLOCATION=$(echo $USERLOCATION | sed -e 's/[\/&]/\\&/g')
USERHFCPORT=$(echo $USERHFCPORT | sed -e 's/[\/&]/\\&/g')
echo entry point!
curl -sL https://github.com/ServiceStackApps/mono-server-config/raw/master/nginx-config/hello-app.conf.tpl | sed -e "s/\${SITENAME}/$USERSITE/" -e "s/\${HFCPORT}/$USERHFCPORT/" -e "s/\${SITELOCATION}/$USERLOCATION/" > hfc-install/config/$USERSITE.conf
ls /home/hfc-install/config
curl -sL https://github.com/ServiceStackApps/mono-server-config/raw/master/hfc-config/hfc.config.tpl | sed -e "s/\${SITENAME}/$USERSITE/" -e "s/\${HFCPORT}/$USERHFCPORT/" -e "s/\${SITELOCATION}/$USERLOCATION/" > hfc-install/config/hfc.config
#cat /home/hfc-install/config/hfc.config
echo "Configure site"
cd /home/hfc-install
cp config/$USERSITE.conf /etc/nginx/sites-available/
ln -s /etc/nginx/sites-available/$USERSITE.conf /etc/nginx/sites-enabled/
echo "Disable default nginx site"
rm /etc/nginx/sites-enabled/default
echo "Update /etc/nginx/fastcgi_params"
sed -e "s/\(fastcgi_param[[:space:]]*SCRIPT_FILENAME\)/#\1/" -e "s/\(fastcgi_param[[:space:]]*PATH_INFO\)/#\1/" /etc/nginx/fastcgi_params > config/fastcgi_params
cp config/fastcgi_params /etc/nginx/fastcgi_params
mkdir -p /etc/hyperfastcgi
mkdir -p /var/log/hyperfastcgi
chown -R www-data:www-data /var/log/hyperfastcgi
cp config/hfc.config /etc/hyperfastcgi
cat /etc/nginx/sites-available/$USERSITE.conf
ls /var/www/hello-app
/etc/init.d/nginx restart
hyperfastcgi4 /config=/etc/hyperfastcgi/hfc.config
#/bin/bash