Created by
Andrey Chesnakov
| #!/bin/sh
for ip in $(ls /root/mnt/); do
config="/root/nginx/sites-enabled/$ip.conf"
root="/usr/local/www/nginx-dist"
[ -s "/root/mnt/$ip/503.html" ] && root="/usr/local/www/nginx-dist/$ip" \
&& mkdir -p "$root" && cp "/root/mnt/$ip/503.html" "$root/"
for domain in $(ls -d "/root/mnt/$ip"/*/); do
domain=${domain#/root/mnt/$ip/}
domain=${domain%/}
ssl_domain=default
[ -s "/root/mnt/$ip/$domain/key" ] && [ -s "/root/mnt/$ip/$domain/combined" ] && ssl_domain="$domain" \
&& cp "/root/mnt/$ip/$domain/combined" "/root/nginx/ssl/$domain.combined" && cp "/root/mnt/$ip/$domain/key" "/root/nginx/ssl/$domain.key"
[ -s "/root/mnt/$ip/$domain/503.html" ] && root="/usr/local/www/nginx-dist/$ip/$domain" \
&& mkdir -p "$root" && cp "/root/mnt/$ip/503.html" "$root/"
cat <<EOF >"$config"
server {
listen $ip:80;
listen $ip:443 ssl http2;
ssl_certificate ssl/$ssl_domain.combined;
ssl_certificate_key ssl/$ssl_domain.key;
server_name $domain *.$domain;
location / {
error_page 503 /503.html;
return 503;
}
location = /503.html {
root $root;
}
}
EOF
done
done
|
| #!/bin/sh
([ -z "$1" ] || [ -z "$2" ]) && echo usage: $0 DD.MM HH:MM && exit 1
find /root/mnt/ /root/nginx-dist/ -type f -name 503.html -exec sed -i '' "s#<span class=eta>[^<]*<#<span class=eta>$1 $2<#" {} \;
|