-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebian-deploy-nginx.sh
More file actions
96 lines (77 loc) · 2.05 KB
/
Copy pathdebian-deploy-nginx.sh
File metadata and controls
96 lines (77 loc) · 2.05 KB
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
#!/bin/bash
if [ "$USER" != "root" ];then
echo "Please start the script with ROOT"
exit
fi
apt-get clean
apt-get autoclean
apt-get update
echo "== Installing:"
apt-get -y --force-yes remove --purge nginx
apt-get -y install php5-common php5-dev php5-mysql php5-sqlite php5-tidy php5-xmlrpc php5-xsl php5-cgi php5-mcrypt php5-curl php5-gd php5-memcache php5-mhash php5-pspell php5-snmp php5-sqlite libmagick9-dev php5-cli
apt-get -y install nginx
# apt-get -y --force-yes install mysql-server mysql-client
echo '
#!/bin/bash
BIND=127.0.0.1:9000
USER=www-data
PHP_FCGI_CHILDREN=15
PHP_FCGI_MAX_REQUESTS=1000
PHP_CGI=/usr/bin/php-cgi
PHP_CGI_NAME=`basename $PHP_CGI`
PHP_CGI_ARGS="- USER=$USER PATH=/usr/bin PHP_FCGI_CHILDREN=$PHP_FCGI_CHILDREN PHP_FCGI_MAX_REQUESTS=$PHP_FCGI_MAX_REQUESTS $PHP_CGI -b $BIND"
RETVAL=0
start() {
echo -n "Starting PHP FastCGI: "
start-stop-daemon --quiet --start --background --chuid "$USER" --exec /usr/bin/env -- $PHP_CGI_ARGS
RETVAL=$?
echo "$PHP_CGI_NAME."
}
stop() {
echo -n "Stopping PHP FastCGI: "
killall -q -w -u $USER $PHP_CGI
RETVAL=$?
echo "$PHP_CGI_NAME."
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo "Usage: php-fastcgi {start|stop|restart}"
exit 1
;;
esac
exit $RETVAL
' > /etc/init.d/php-fastcgi
rm /etc/nginx/sites-enabled/*
echo "== Cleaning:"
apt-get -y autoremove
apt-get -y autoclean
apt-get -y clean
echo "== Stop Service:"
/etc/init.d/php-fastcgi stop 2> /dev/null
/etc/init.d/nginx stop 2> /dev/null
/etc/init.d/bind9 stop 2> /dev/null
/etc/init.d/apache2 stop 2> /dev/null
/etc/init.d/mysql stop 2> /dev/null
/etc/init.d/php5-cgi stop 2> /dev/null
/etc/init.d/php5-fpm stop 2> /dev/null
killall php5-cgi 2> /dev/null
killall php5-fpm 2> /dev/null
update-rc.d -f bind9 remove
update-rc.d -f apache2 remove
chmod 755 /etc/init.d/php-fastcgi
cp ./nginx.conf /etc/nginx/nginx.conf
bash /etc/init.d/php-fastcgi restart
bash /etc/init.d/nginx restart
echo "
NGINX Installed and running.
"