23 lines
1.1 KiB
Plaintext
23 lines
1.1 KiB
Plaintext
|
#!/bin/bash
|
||
|
|
||
|
SUBDOMAIN=$1
|
||
|
|
||
|
if [[ -z "$SUBDOMAIN" ]]; then
|
||
|
echo "Set subdomain"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
sed -i 's/subdomain/'$SUBDOMAIN'/g' /etc/nginx/sites-available/subdomain.krov.dmz.rs
|
||
|
sed -i 's/subdomain/'$SUBDOMAIN'/g' /etc/nginx/sites-available/subdomain.krov.dmz.rs.https
|
||
|
mkdir /var/www/"$SUBDOMAIN"krovdmzrs/
|
||
|
mv /etc/nginx/sites-available/subdomain.krov.dmz.rs /etc/nginx/sites-available/"$SUBDOMAIN".krov.dmz.rs
|
||
|
mv /etc/nginx/sites-available/subdomain.krov.dmz.rs.https /etc/nginx/sites-available/"$SUBDOMAIN".krov.dmz.rs.https
|
||
|
ln -s /etc/nginx/sites-available/"$SUBDOMAIN".krov.dmz.rs /etc/nginx/sites-enabled/"$SUBDOMAIN".krov.dmz.rs
|
||
|
service nginx reload
|
||
|
certbot certonly -d "$SUBDOMAIN".krov.dmz.rs,"$SUBDOMAIN".krov.decentrala.org --webroot -w /var/www/"$SUBDOMAIN"krovdmzrs
|
||
|
cat /etc/nginx/sites-available/"$SUBDOMAIN".krov.dmz.rs /etc/nginx/sites-available/"$SUBDOMAIN".krov.dmz.rs.https > /etc/nginx/sites-available/"$SUBDOMAIN".krov.dmz.rs.all
|
||
|
mv /etc/nginx/sites-available/"$SUBDOMAIN".krov.dmz.rs.all /etc/nginx/sites-available/"$SUBDOMAIN".krov.dmz.rs
|
||
|
rm /etc/nginx/sites-available/"$SUBDOMAIN".krov.dmz.rs.https
|
||
|
service nginx reload
|
||
|
rm /root/remotecmd.sh
|