-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.sh
42 lines (37 loc) · 862 Bytes
/
script.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
#!/bin/bash
# for running this script , ./script.sh PORTNO EMAIL DOMAIN_NAME aws_flag
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
. ~/.nvm/nvm.sh
nvm install node
node -v
npm -v
apt-get update -y
apt-get install git -y
git — version
git clone [email protected]:2024-Open-Soft/Backend.git
# cd Backend
# npm install
# npm start
# project has been setup
PORTNO=$1
DOMAIN_NAME=$2
# nginx setup
nginx_conf="
server {
listen 80;
client_max_body_size 10M;
location / {
proxy_pass http://localhost:3001;
}
}
"
if ! command -v nginx >/dev/null; then
sudo apt-get update
sudo apt-get install -y nginx
fi
sudo -u root bash -c "echo '$nginx_conf' >/etc/nginx/sites-available/default"
if systemctl is-active -q ngin x; then
sudo systemctl restart nginx
else
sudo systemctl enable --now nginx
fi