-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
addsld
38 lines (34 loc) · 853 Bytes
/
addsld
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
#!/bin/bash
# Setup NGINX config
printf "server {
listen 80;
listen [::]:80;
root $PWD;
index index.html;
server_name $2.$1;
location / {
try_files \$uri \$uri/ @htmlext;
}
location ~ \.html$ {
try_files \$uri =404;
}
location @htmlext {
rewrite ^(.*)$ \$1.html last;
}
error_page 404 /404.html;
location = /404.html {
internal;
}
location = /.well-known/wallets/HNS {
add_header Cache-Control 'must-revalidate';
add_header Content-Type text/plain;
}
listen 443 ssl;
ssl_certificate /etc/ssl/$1.crt;
ssl_certificate_key /etc/ssl/$1.key;
}
" > /etc/nginx/sites-available/$2.$1
sudo ln -s /etc/nginx/sites-available/$2.$1 /etc/nginx/sites-enabled/$2.$1
# Restart to apply config file
sudo chmod a+rx $PWD
sudo systemctl restart nginx