27 lines
1.4 KiB
Bash
Executable File
27 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
SUBDOMAIN=$1
|
|
SUBNODOT=$(echo -n $1 | cut -d"." -f1- --output-delimiter="" )
|
|
|
|
if [[ -z "$SUBDOMAIN" ]]; then
|
|
echo "Set subdomain"
|
|
exit 1
|
|
fi
|
|
|
|
sed -i 's/subdomain/'$SUBDOMAIN'/g' /etc/nginx/sites-available/subdomain.dmz.rs.http
|
|
sed -i 's/subdomain/'$SUBDOMAIN'/g' /etc/nginx/sites-available/subdomain.dmz.rs.https
|
|
sed -i 's/subnodot/'$SUBNODOT'/g' /etc/nginx/sites-available/subdomain.dmz.rs.http
|
|
sed -i 's/subnodot/'$SUBNODOT'/g' /etc/nginx/sites-available/subdomain.dmz.rs.https
|
|
mkdir /var/www/"$SUBNODOT"dmzrs/
|
|
mv /etc/nginx/sites-available/subdomain.dmz.rs.http /etc/nginx/sites-available/"$SUBDOMAIN".dmz.rs.http
|
|
mv /etc/nginx/sites-available/subdomain.dmz.rs.https /etc/nginx/sites-available/"$SUBDOMAIN".dmz.rs.https
|
|
ln -s /etc/nginx/sites-available/"$SUBDOMAIN".dmz.rs.http /etc/nginx/sites-enabled/"$SUBDOMAIN".dmz.rs.http
|
|
service nginx reload
|
|
certbot certonly -d "$SUBDOMAIN".dmz.rs,"$SUBDOMAIN".decentrala.org --webroot -w /var/www/"$SUBNODOT"dmzrs
|
|
cat /etc/nginx/sites-available/"$SUBDOMAIN".dmz.rs.http /etc/nginx/sites-available/"$SUBDOMAIN".dmz.rs.https > /etc/nginx/sites-available/"$SUBDOMAIN".dmz.rs.all
|
|
mv /etc/nginx/sites-available/"$SUBDOMAIN".dmz.rs.all /etc/nginx/sites-available/"$SUBDOMAIN".dmz.rs
|
|
rm /etc/nginx/sites-available/"$SUBDOMAIN".dmz.rs.https
|
|
rm /etc/nginx/sites-available/"$SUBDOMAIN".dmz.rs.http
|
|
service nginx reload
|
|
rm /root/remotecmd.sh
|