home · contact · privacy
d4d3a61580a8461ed0dac0eb553189d46fd53905
[config] / bookworm / setup_scripts / setup_web.sh
1 #!/bin/sh
2 set -e
3 . ./misc.sh
4
5 expect_n_args 1 "(domain name)" "$@"
6 domain="$1"
7
8 # Install configs, set up firewall.
9 ./install_for_target.sh web static_websites
10 ./copy_dirtree.sh "${config_tree_prefix}/etc_files" "" web static_websites
11 nft -f /etc/nftables.conf
12
13 # Set up letsencrypt certificate. TODO: Is it auto-renewed?
14 ln -sf /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default
15 certbot --nginx --agree-tos --redirect --no-eff-email -m "${mail}" -d "${domain}"
16 rm /etc/nginx/sites-enabled/default
17
18 # Prepare NGINX for status.plomlompom.com.
19 sed -i "s/REPLACE_fqdn_ECALPER/${domain}/g" /etc/nginx/sites-available/status.plomlompom.com.nginx
20 ln -s /etc/nginx/sites-available/status.plomlompom.com.nginx /etc/nginx/sites-enabled/status.plomlompom.com.nginx
21
22 service nginx restart