-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathapache.sh
More file actions
executable file
·43 lines (33 loc) · 1.22 KB
/
apache.sh
File metadata and controls
executable file
·43 lines (33 loc) · 1.22 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
#!/bin/bash
source load_config.sh
echo "-------------------------------------------------------------"
echo "Apache configuration"
echo "-------------------------------------------------------------"
sudo apt-get install -y apache2 gettext
sudo chown $user /var/www
# create emoncms www folder
if [ ! -d $emoncms_www ]; then
echo "-- create emoncms www folder for Apache"
mkdir $emoncms_www
else
echo "-- emoncms www folder already installed"
fi
# Create emoncms logfolder
if [ ! -d $emoncms_log_location ]; then
echo "-- creating emoncms log folder"
sudo mkdir $emoncms_log_location
sudo chown $user $emoncms_log_location
else
echo "-- log folder already exists"
fi
sudo sed -i "s/^CustomLog/#CustomLog/" /etc/apache2/conf-available/other-vhosts-access-log.conf
# Enable apache mod rewrite
sudo a2enmod rewrite
# Default apache2 configuration
sudo cp $openenergymonitor_dir/EmonScripts/defaults/apache2/emonsd.conf /etc/apache2/conf-available/emonsd.conf
sudo a2enconf emonsd.conf
# Configure virtual host
sudo cp $openenergymonitor_dir/EmonScripts/defaults/apache2/emoncms.conf /etc/apache2/sites-available/emoncms.conf
sudo a2dissite 000-default.conf
sudo a2ensite emoncms
sudo systemctl restart apache2