first,need a template file like this:
server {
listen 80;
server_name domain_name;
access_log /var/log/nginx/xxx.log;
error_log /var/log/nginx/xxx.error.log;
error_page 497 https://$host$request_uri;
rewrite ^(.*)$ https://${server_name}$1 permanent;
}
server {
listen 443 ssl http2;
server_name domain_name;
access_log /var/log/nginx/xxx.log;
error_log /var/log/nginx/xxx.error.log;
root /data/www/domain_name;
sub_filter_once off;
sub_filter '<head>' '<head><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygo
ogle.js?client=ca-pub-88888888" crossorigin="anonymous"></script>';
index index.html index.htm;
ssl_certificate /etc/nginx/key/moneyslow.com.fullchain.cer;
ssl_certificate_key /etc/nginx/key/moneyslow.com.key;
}
all the domain in file : domain_moneyslow.txt
next , a shell for create config file from domain_moneyslow.txt and template :
#!/bin/bash
while read -r line; do
echo $line;
sed "s/domain_name/$line/g;" template > xxx/$line.conf
done < domain_moneyslow.txt
