-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathwebserver_init.sh
31 lines (26 loc) · 1.1 KB
/
webserver_init.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
#!/bin/bash
#install apache
sudo apt-get -f autoremove
sudo apt-get --asume-yes update
sudo apt-get --assume-yes upgrade
sudo apt-get --assume-yes dist-upgrade
sudo apt-get --assume-yes install apache2
# Apply FW rules to accept connections on 22, 80 and 443
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw allow 22/tcp
sudo ufw --force enable
# enable apache modules and XbitHack for SSI
sudo a2enmod include cgi
cd /var/www/html
sudo rm index.html
sudo wget -O index.html https://raw.githubusercontent.com/MihaMarkocic/cloudservices/master/AWS/web_application_firewall/init_files/index.html
sudo bash -c "sed -i 's/SERVER_NAME/$1/' index.html"
sudo wget https://raw.githubusercontent.com/MihaMarkocic/cloudservices/master/AWS/web_application_firewall/init_files/.htaccess
echo 'XbitHack on' >> /etc/apache2/apache2.conf
sudo bash -c "sed -i 's/Options Indexes FollowSymLinks/Options Indexes FollowSymLinks Includes/' /etc/apache2/apache2.conf"
sudo chmod +x /var/www/html/index.html
# install net-tools to do ifconfig SSI on frontpage
sudo apt install net-tools
#restart apache2 service
sudo systemctl restart apache2