forked from indigo7333/easy_host_scripts_debian
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_programs.sh
163 lines (141 loc) · 4.86 KB
/
install_programs.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
IP=`dig +short myip.opendns.com @resolver1.opendns.com`;
DEBIANVER=`lsb_release -cs`
if [ ! $IP ]
then
echo "enter IP address please";
exit
fi
#only for debian 7
echo "deb http://ftp.debian.org/debian $DEBIANVER-backports main contrib non-free" >> /etc/apt/sources.list
echo "deb http://nginx.org/packages/mainline/debian/ $DEBIANVER nginx" >> /etc/apt/sources.list
echo "deb-src http://nginx.org/packages/mainline/debian/ $DEBIANVER nginx" >> /etc/apt/sources.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ABF5BD827BD9BF62
apt-get update
apt-get upgrade -y
apt-get -y install phpmyadmin mysql-server php5-mysql apache2 nginx php5-intl php5-sqlite php5-gd procmail php5-cli php5-imap php5-curl libapache2-mod-rpaf rdiff-backup rsync
apt-get -y remove exim4 exim4-base exim4-config exim4-daemon-light
apt-get -y install libapache2-mod-ruid2
a2enmod ruid2 rpaf rewrite
#ftp-upload - not required
#procmail needed for lockfile function
#apt-get -t $DEBIANVER-backports install nginx-full
apt-get -y install nginx
echo "NameVirtualHost 127.0.0.1:8080
Listen 127.0.0.1:8080" > /etc/apache2/ports.conf
echo "user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 2048;
multi_accept on;
use epoll;
}
http { sendfile on;
tcp_nopush on;
tcp_nodelay on;
reset_timedout_connection on;
keepalive_timeout 65;
types_hash_max_size 2048;
server_tokens off;
server_names_hash_bucket_size 128;
client_max_body_size 256M;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
gzip on;
gzip_http_version 1.1;
gzip_vary on;
gzip_comp_level 4;
gzip_proxied any;
gzip_min_length 1400;
gzip_static off;
gzip_types text/plain text/xml text/css text/javascript text/js application/x-javascript font/woff application/font-woff application/x-font-woff image/jpeg;
gzip_disable "MSIE [1-6]\.";
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
" > /etc/nginx/nginx.conf
echo "server {
listen 80; ## listen for ipv4; this line is default and implied
root /usr/share/nginx/www;
index index.html index.htm;
server_name $IP;
" > /etc/nginx/sites-enabled/default
echo 'location / {
proxy_pass http://127.0.0.1:8080/;
proxy_redirect http://127.0.0.1:8080/ /;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_connect_timeout 120;
proxy_send_timeout 120;
proxy_read_timeout 180;
}
}
' >> /etc/nginx/sites-enabled/default
echo 'LockFile ${APACHE_LOCK_DIR}/accept.lock
PidFile ${APACHE_PID_FILE}
Timeout 65
KeepAlive Off
MaxKeepAliveRequests 100
KeepAliveTimeout 5
User www-data
Group www-data
<IfModule mpm_prefork_module>
StartServers 10
MinSpareServers 10
MaxSpareServers 50
MaxClients 150
MaxRequestsPerChild 100
</IfModule>
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
AccessFileName .htaccess
<Files ~ "^\.ht">
Order allow,deny
Deny from all
Satisfy all
</Files>
DefaultType None
HostnameLookups Off
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
Include mods-enabled/*.load
Include mods-enabled/*.conf
Include ports.conf
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
Include conf.d/
ServerTokens ProductOnly
ServerSignature Off
Include sites-enabled/
' > /etc/apache2/apache2.conf
echo "<VirtualHost 127.0.0.1:8080>
ServerName $IP
ServerAdmin [email protected]
DocumentRoot /var/www
<Directory /var/www>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
" > /etc/apache2/sites-enabled/default
chmod 777 -R /var/log/apache2
chmod 777 -R /var/log/nginx
sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 256M/g' /etc/php5/*/php.ini
sed -i 's/post_max_size = 8M/post_max_size = 256M/g' /etc/php5/*/php.ini
sed -i 's/session.gc_probability = 0/session.gc_probability = 1/g' /etc/php5/*/php.ini
sed -i 's/session.gc_divisor = 1000/session.gc_divisor = 100/g' /etc/php5/*/php.ini
sed -i 's/session.gc_maxlifetime = 1440/session.gc_maxlifetime = 5400/g' /etc/php5/*/php.ini
rm /etc/apache2/sites-enabled/000-default
/etc/init.d/apache2 restart
/etc/init.d/nginx restart