-
Notifications
You must be signed in to change notification settings - Fork 50
/
nginxautoinstall.sh
executable file
·62 lines (52 loc) · 1.85 KB
/
nginxautoinstall.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
#!/bin/bash
#
# Mon script d'installation automatique de NGinx (depuis les sources)
# Pour Ubuntu Desktop et Ubuntu Server
#
# Nicolargo - 02/2011
# GPL
#
# Syntaxe: # sudo ./nginxautoinstall.sh
VERSION="1.1"
##############################
# Debut de l'installation
# Test que le script est lance en root
if [ $EUID -ne 0 ]; then
echo "Le script doit être lancé en root: # sudo $0" 1>&2
exit 1
fi
# Ajout dépot NGinx
add-apt-repository ppa:nginx/stable
# Ajout dépot PHP5-FPM
add-apt-repository ppa:brianmercer/php
# MaJ des depots
aptitude update
# Installation
aptitude install nginx
aptitude install php5-cli php5-common php5-mysql php5-suhosin php5-fpm php5-cgi php-pear php5-xcache php5-gd php5-curl
aptitude install libcache-memcached-perl php5-memcache memcached
# Download the default configuration file
# Nginx + default site
wget --no-check-certificate https://raw.github.com/nicolargo/debianpostinstall/master/default-site
mv default-site /etc/nginx/sites-available/
ln -s /etc/nginx/sites-available/default-site /etc/nginx/sites-enabled/default-site
# Start PHP5-FPM and NGinx
/etc/init.d/php5-fpm start
/etc/init.d/nginx start
# Summary
echo ""
echo "--------------------------------------"
echo "NGinx + PHP5-FPM installation finished"
echo "--------------------------------------"
echo "NGinx configuration folder: /etc/nginx"
echo "NGinx default site configuration: /etc/nginx/sites-enabled/default-site"
echo "NGinx default HTML root: /var/www"
echo ""
echo "If you use IpTables add the following rules:"
echo "iptables -A INPUT -i lo -s localhost -d localhost -j ACCEPT"
echo "iptables -A OUTPUT -o lo -s localhost -d localhost -j ACCEPT"
echo "iptables -A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT"
echo "iptables -A INPUT -p tcp --dport http -j ACCEPT"
echo "--------------------------------------"
echo ""
# Fin du script