Added multi subdomain
This commit is contained in:
parent
ea0f853a58
commit
52a75d34b3
4 changed files with 28 additions and 21 deletions
|
@ -811,6 +811,7 @@ ip_install() {
|
|||
LOCAL_DOMAIN_=`echo ${LOCAL_DOMAIN} | sed -r "s/[^A-Za-z0-9]/_/g"`
|
||||
LOCAL_CLOUDFLARE_EMAIL=${2:-${CLOUDFLARE_EMAIL}}
|
||||
LOCAL_CLOUDFLARE_API_KEY=${3:-${CLOUDFLARE_API_KEY}}
|
||||
if [ "${4}" ]; then LOCAL_SUBDOMAIN="$(echo "${4}" | sed -r "s/[^A-Za-z0-9]//g")."; fi
|
||||
|
||||
echo "${PRC_}% https" >>/var/log/docker_log_"$(date '+%d_%m_%Y')".log
|
||||
|
||||
|
@ -839,17 +840,18 @@ ip_install() {
|
|||
--email "support@${LOCAL_DOMAIN}" \
|
||||
--non-interactive \
|
||||
--agree-tos \
|
||||
-d "${LOCAL_DOMAIN}" \
|
||||
-d "*.${LOCAL_DOMAIN}" \
|
||||
-d "${LOCAL_SUBDOMAIN}${LOCAL_DOMAIN}" \
|
||||
-d "*.${LOCAL_SUBDOMAIN}${LOCAL_DOMAIN}" \
|
||||
--server https://acme-v02.api.letsencrypt.org/directory \
|
||||
>>/var/log/https_"$(date '+%d_%m_%Y')".log 2>&1
|
||||
|
||||
sleep 15
|
||||
|
||||
if [ -d "${NGX}/ssl.d/live/${LOCAL_DOMAIN}/" ]; then
|
||||
openssl dhparam -out "${NGX}/ssl.d/live/${LOCAL_DOMAIN}/dhparam.pem" 2048 \
|
||||
if [ -d "${NGX}/ssl.d/live/${LOCAL_SUBDOMAIN}${LOCAL_DOMAIN}/" ]; then
|
||||
openssl dhparam -out "${NGX}/ssl.d/live/${LOCAL_SUBDOMAIN}${LOCAL_DOMAIN}/dhparam.pem" 2048 \
|
||||
>>/var/log/https_"$(date '+%d_%m_%Y')".log 2>&1
|
||||
sed -Ei "s/self-signed/live/g" "${NGX}/ssl.d/default.conf"
|
||||
sed -Ei "s~/self-signed/~/live/~g" "${NGX}/ssl.d/default.conf"
|
||||
sed -Ei "s~live/${LOCAL_DOMAIN}~live/${LOCAL_SUBDOMAIN}${LOCAL_DOMAIN}~g" "${NGX}/ssl.d/default.conf"
|
||||
sed -Ei "s/#ssl //g" "${NGX}/conf.d/default.conf"
|
||||
sed -Ei "s/\"protocol\":\s*\"http:/\"protocol\":\"https:/" \
|
||||
"/home/${LOCAL_DOMAIN}/config/production/config.js"
|
||||
|
@ -2134,12 +2136,12 @@ while [ "${WHILE}" -lt "2" ]; do
|
|||
exit 0
|
||||
;;
|
||||
"h"|"https"|6 )
|
||||
read_domain ${2}
|
||||
read_domain "${2}"
|
||||
sh_not
|
||||
read_cloudflare_email ${3}
|
||||
read_cloudflare_api_key ${4}
|
||||
_s ${4}
|
||||
6_https ${2} ${3} ${4}
|
||||
read_cloudflare_email "${3}"
|
||||
read_cloudflare_api_key "${4}"
|
||||
_s "${4}"
|
||||
6_https "${2}" "${3}" "${4}" "${5}"
|
||||
post_commands
|
||||
exit 0
|
||||
;;
|
||||
|
|
|
@ -858,8 +858,11 @@ if (config.botdomain && hour === 5) {
|
|||
}
|
||||
}
|
||||
if (danger) {
|
||||
var num = parseInt(config.botdomain.replace(/[^0-9]/g, '') || '0') + 1;
|
||||
config.botdomain = config.botdomain + num;
|
||||
var words = config.botdomain.split('.').filter(Boolean);
|
||||
|
||||
var num = parseInt(words[0].replace(/[^0-9]/g, '') || '0') + 1;
|
||||
words[0] = words[0] + num;
|
||||
config.botdomain = words.join('.') + '.';
|
||||
|
||||
CP_save.save(config, 'config', function(err) {
|
||||
if (err) console.log('[CP_save.save]', err);
|
||||
|
@ -1656,7 +1659,9 @@ function dayToLetter() {
|
|||
.reverse()
|
||||
.join('');
|
||||
}
|
||||
return result + '.';
|
||||
var words = config.subdomain.split('.').filter(Boolean);
|
||||
words[0] = result;
|
||||
return words.join('.') + '.';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -720,9 +720,9 @@
|
|||
}
|
||||
|
||||
if (data.config && data.config.subdomain) {
|
||||
data.config.subdomain = data.config.subdomain.replace(/\./g, '') + '.';
|
||||
if (data.config.subdomain === 'www.' || data.config.subdomain === 'tv.' || data.config.subdomain === 'm.' || data.config.subdomain === 'app.') {
|
||||
alert('NOT «m.», «tv.», «www.», «app.»!');
|
||||
data.config.subdomain = data.config.subdomain.replace(/\.$/g, '') + '.';
|
||||
if (data.config.subdomain === 'www.' || data.config.subdomain === 'tv.' || data.config.subdomain === 'm.' || data.config.subdomain === 'app.' || data.config.subdomain === 'ftp.') {
|
||||
alert('NOT «m.», «tv.», «www.», «app.», «ftp.»!');
|
||||
self.innerHTML = '<span class="fa fa-save"></span> <%= __('Сохранить изменения') %>';
|
||||
self.addEventListener('click', saveData);
|
||||
return;
|
||||
|
@ -730,9 +730,9 @@
|
|||
}
|
||||
|
||||
if (data.config && data.config.botdomain) {
|
||||
data.config.botdomain = data.config.botdomain.replace(/\./g, '') + '.';
|
||||
if (data.config.botdomain === 'www.' || data.config.botdomain === 'tv.' || data.config.botdomain === 'm.') {
|
||||
alert('NOT «m.», «tv.», «www.»!');
|
||||
data.config.botdomain = data.config.botdomain.replace(/\.$/g, '') + '.';
|
||||
if (data.config.botdomain === 'www.' || data.config.botdomain === 'tv.' || data.config.botdomain === 'm.' || data.config.botdomain === 'app.' || data.config.botdomain === 'ftp.') {
|
||||
alert('NOT «m.», «tv.», «www.», «app.», «ftp.»!');
|
||||
self.innerHTML = '<span class="fa fa-save"></span> <%= __('Сохранить изменения') %>';
|
||||
self.addEventListener('click', saveData);
|
||||
return;
|
||||
|
|
|
@ -112,7 +112,7 @@
|
|||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
<input name="config.subdomain"
|
||||
value="<%= config.subdomain.replace(/\./g, '') %>"
|
||||
value="<%= config.subdomain.replace(/\.$/, '') %>"
|
||||
class="form-control input_url text-right" type="text"
|
||||
placeholder="blog">
|
||||
</div>
|
||||
|
@ -132,7 +132,7 @@
|
|||
<div class="input-group">
|
||||
<span class="input-group-addon text-muted"><%= __('Поддомен для ботов') %>:</span>
|
||||
<input name="config.botdomain"
|
||||
value="<%= config.botdomain.replace(/\./g, '') %>"
|
||||
value="<%= config.botdomain.replace(/\.$/, '') %>"
|
||||
class="form-control input_url text-right" type="text"
|
||||
placeholder="<%= config.language %>">
|
||||
<span class="input-group-addon text-muted">.<%= config.domain %></span>
|
||||
|
|
Loading…
Reference in a new issue