-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·40 lines (30 loc) · 987 Bytes
/
install.sh
File metadata and controls
executable file
·40 lines (30 loc) · 987 Bytes
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
#!/bin/bash
echo "Installing nginx..."
vs_package -i nginx
echo "Installing curl..."
vs_package -i curl
echo "Creating root directory..."
mkdir -p /var/www/example.com/public_html
echo "Setting up permissions..."
nginx_user=$(grep user /etc/nginx/nginx.conf | head -1 | awk '{print $2}' | sed 's/\;//g')
chown -R $nginx_user:$nginx_user /var/www/example.com/public_html
chmod 755 /var/www
echo "Creating the page..."
cp files/index.html /var/www/example.com/public_html
echo "Creating the new virtual host file..."
if [ ! -f '/etc/nginx/sites-available' ]
then
mkdir -p /etc/nginx/sites-available
fi
if [ ! -f '/etc/nginx/sites-enabled' ]
then
mkdir -p /etc/nginx/sites-enabled
fi
cp files/example.com /etc/nginx/sites-available/example.com
ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/example.com
if [ -f '/etc/nginx/sites-enabled/default' ]
then
rm /etc/nginx/sites-enabled/default
fi
echo "Restarting nginx..."
vs_service --restart nginx