-
Notifications
You must be signed in to change notification settings - Fork 4
/
setup.sh
executable file
·67 lines (57 loc) · 2.36 KB
/
setup.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
#!/usr/bin/env bash
# shellcheck disable=SC2154
export DEBIAN_FRONTEND="noninteractive"
sudo apt update -y
sudo apt install python3.8* git nginx python-certbot-nginx python3-pip -y
cd /tmp || exit
sudo certbot --noninteractive --nginx --agree-tos --email [email protected] --domain hades.thescriptgroup.in
cat << EOF | sudo tee /etc/nginx/sites-available/hades.thescriptgroup.in
server {
listen 80;
server_name hades.thescriptgroup.in;
location ^~ /.well-known/acme-challenge/ {
root /var/www/html;
}
location / {
return 301 https://hades.thescriptgroup.in$request_uri;
}
}
server {
listen 443 ssl;
server_name hades.thescriptgroup.in;
ssl_certificate /etc/letsencrypt/live/hades.thescriptgroup.in/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/hades.thescriptgroup.in/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
location /static {
root /home/akhil/Hades/hades;
try_files \$uri \$uri/ =404;
}
location ^~ / {
if (\$http_origin ~* (^https:\/\/thescriptgroup\.in$)) {
add_header Access-Control-Allow-Origin \$http_origin;
}
if (\$http_origin ~* (^https:\/\/charon\.thescriptgroup\.in$)) {
add_header Access-Control-Allow-Origin \$http_origin;
add_header Access-Control-Allow-Headers "credentials";
}
proxy_pass http://127.0.0.1:5500;
proxy_redirect off;
proxy_set_header Host \$host;
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto \$scheme;
}
}
EOF
sudo ln -s /etc/nginx/sites-available/hades.thescriptgroup.in /etc/nginx/sites-enabled/hades.thescriptgroup.in
sudo rm -fv /etc/nginx/sites-{available,enabled}/default
sudo nginx -s reload
echo '30 2 * * * /usr/bin/certbot renew --noninteractive --renew-hook "/usr/sbin/nginx -s reload" >> /var/log/le-renew.log' > /tmp/cron
sudo crontab /tmp/cron
rm -v /tmp/cron
cd - || exit
git clone https://github.com/The-SCRIPT-Group/Hades.git
cd Hades || exit
pip3 install -r requirements.txt
echo "Setup your configuration file and run the application! (make sure its running on port 5000, should be the default with waitress)"