zjcqoo 6 лет назад
Родитель
Сommit
6b06f808c6
4 измененных файлов с 33 добавлено и 4 удалено
  1. 3 1
      allowed-sites.conf
  2. 3 0
      cert/cert.conf
  3. 3 3
      lua/http-enc-res-hdr.lua
  4. 24 0
      upload.sh

+ 3 - 1
allowed-sites.conf

@@ -10,11 +10,13 @@ http://127.0.0.1:8080             '127';
 http://localhost                  'lo';
 http://localhost:8080             'lo';
 
+https://jsproxy.tk                'js-tk';
+
 # 接口和网站同源,这种情况下 origin 为空
 ''                                'mysite';
 
 # ~ 开头为正则匹配,此处允许 github.io 所有子站点
-~^https://([\w-]+)\.github\.io$     'gh-$1';
+~^https://([\w-]+)\.github\.io$   'gh-$1';
 
 # 允许任何站点使用
 # ~(.*)                             '$1';

+ 3 - 0
cert/cert.conf

@@ -0,0 +1,3 @@
+listen                8443 ssl http2;
+ssl_certificate       cert/etherdream.com/ecc.cer;
+ssl_certificate_key   cert/etherdream.com/ecc.key;

+ 3 - 3
lua/http-enc-res-hdr.lua

@@ -111,9 +111,9 @@ local function nodeSwitched()
 end
 
 -- 节点切换功能,目前还在测试中(demo 中已开启)
--- if nodeSwitched() then
---   return
--- end
+if nodeSwitched() then
+  return
+end
 
 
 local h, err = ngx.resp.get_headers()

+ 24 - 0
upload.sh

@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+# 功能:同步文件到所有节点,并重启服务
+
+HOST=etherdream.com
+NODE=(
+  aliyun-hk-2
+  # aliyun-hk-0
+  # aliyun-hk-1
+  # aliyun-sg
+)
+for v in ${NODE[@]}; do
+  echo "$v upload ..."
+
+  rsync . jsproxy@$v.$HOST:server \
+    -a \
+    --exclude='nginx/cache/*' \
+    --exclude='nginx/logs/*'
+
+  echo "$v restart ..."
+
+  ssh jsproxy@$v.$HOST "./server/run.sh reload"
+done
+
+echo "done"