Files
nginx-main/bin/add_server.sh
2025-12-03 17:09:07 +00:00

15 lines
441 B
Bash
Executable File

#!/bin/bash
read -p "Enter server name: " SERVER_NAME
mkdir .tmp
cp ./config/nginx/template/http_location.conf .tmp/"$SERVER_NAME.conf"
# Replace placeholder SERVER_NAME in the copied file
sed -i "s/SERVER_NAME/$SERVER_NAME/g" .tmp/"$SERVER_NAME.conf"
mv .tmp/"$SERVER_NAME.conf" ./config/nginx/conf.d/
docker exec -it nginx-main nginx -s reload
docker exec -it certbot certbot certaonly --nginx -d "$SERVER_NAME" -d "www.$SERVER_NAME"