-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
domain.sh
executable file
·109 lines (86 loc) · 2.67 KB
/
domain.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/bash
# Issue: Getting Error while executing a .sh file: /bin/bash^M: bad interpreter
# sed -i -e 's/\r$//' ./ubuntu-20-04.sh
echo 'Domain manage for ubuntu 20.04';
while :
do
echo $'\n';
echo '0: Exit';
echo '1: Install domain with letsencrypt';
echo '2: Install domain without letsencrypt';
echo $'\n';
read -p 'Select your choice: ' selector;
echo $'\n';
case $selector in
0)
echo "Exit"
break;
;;
1)
echo "sudo apt-get update";
sudo apt-get update
echo "Enter Domain Name"
read -p 'Domain (Ex: xx.xx): ' domain
echo "
server {
listen 80;
listen [::]:80;
root /var/www/html;
index index.nginx-debian.html;
proxy_connect_timeout 6000;
proxy_send_timeout 6000;
proxy_read_timeout 6000;
send_timeout 6000;
client_max_body_size 200M;
server_name $domain;
location / {
proxy_pass http://127.0.0.1:8000;
}
}
" >> /etc/nginx/sites-available/$domain
echo "Map With Site Enable";
sudo ln -s /etc/nginx/sites-available/$domain /etc/nginx/sites-enabled/
systemctl reload nginx
echo "letsencrypt install"
certbot --nginx -d $domain
echo "Domain Create Done";
echo $'\n';
continue;
;;
2)
echo "sudo apt-get update";
sudo apt-get update
echo "Enter Domain Name"
read -p 'Domain (Ex: xx.xx): ' domain
echo "Enter Port Number"
read -p 'Number (Ex: 3000): ' port
echo "
server {
listen 80;
listen [::]:80;
root /var/www/html;
index index.nginx-debian.html;
proxy_connect_timeout 6000;
proxy_send_timeout 6000;
proxy_read_timeout 6000;
send_timeout 6000;
client_max_body_size 200M;
server_name $domain;
location / {
proxy_pass http://0.0.0.0:$port;
}
}
" >> /etc/nginx/sites-available/$domain
echo "Map With Site Enable";
sudo ln -s /etc/nginx/sites-available/$domain /etc/nginx/sites-enabled/
systemctl reload nginx
echo "Domain Create Done";
echo $'\n';
continue;
;;
*)
echo "Sorry, Try Again"
continue;
;;
esac
done