-
Notifications
You must be signed in to change notification settings - Fork 0
/
Instala_apache2_ubuntu.sh
54 lines (41 loc) · 1.45 KB
/
Instala_apache2_ubuntu.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
#!/bin/bash
# Instala Apache
apt-get update
apt-get install -y net-tools xvfb freetype2-demos fontconfig libgl1-mesa-glx libgl1-mesa-dev libglu1-mesa libglu1-mesa-dev libxtst6 libxtst-dev
apt-get install -y apache2
# Cria usuário e grupo "apache"
groupadd apache
useradd -s /bin/false -g apache -d /var/www apache
# Concede Permissões para usuário e grupo Apache
chown -R apache:apache /var/www
# Habilita os Módulos SSL, Proxy, e Cache
a2enmod ssl
a2enmod proxy
a2enmod proxy_http
a2enmod proxy_ajp
a2enmod cache
a2enmod proxy_html
a2enmod mod_ssl
mkdir -p /etc/libapache2-mod-jk/
# Cria o arquivo mod_jk.conf e configura-o
echo "LoadModule jk_module /usr/lib/apache2/modules/mod_jk.so
JkWorkersFile /etc/libapache2-mod-jk/workers.properties
JkLogFile /var/log/apache2/mod_jk.log
JkLogLevel info
JkLogStampFormat \"[%a %b %d %H:%M:%S %Y] \"
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat \"%w %V %T\"
JkMount /example/* loadbalancer" > /etc/apache2/mods-available/mod_jk.conf
# Criar o arquivo workers.properties
echo "worker.list=loadbalancer
worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=worker1,worker2
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
worker.worker2.type=ajp13
worker.worker2.host=localhost
worker.worker2.port=8109" > /etc/libapache2-mod-jk/workers.properties
chown -R apache:apache /etc/libapache2-mod-jk
# Reinicia o Apache
systemctl restart apache2