From 6b06f808c6e79d161616092ecb87f7d21048022a Mon Sep 17 00:00:00 2001 From: zjcqoo Date: Fri, 31 May 2019 11:26:44 +0800 Subject: [PATCH] demo conf --- allowed-sites.conf | 4 +++- cert/cert.conf | 3 +++ lua/http-enc-res-hdr.lua | 6 +++--- upload.sh | 24 ++++++++++++++++++++++++ 4 files changed, 33 insertions(+), 4 deletions(-) create mode 100755 upload.sh diff --git a/allowed-sites.conf b/allowed-sites.conf index 1cd3662..98afc05 100644 --- a/allowed-sites.conf +++ b/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'; diff --git a/cert/cert.conf b/cert/cert.conf index e69de29..ab52666 100644 --- a/cert/cert.conf +++ b/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; \ No newline at end of file diff --git a/lua/http-enc-res-hdr.lua b/lua/http-enc-res-hdr.lua index 6386dcf..9913e51 100644 --- a/lua/http-enc-res-hdr.lua +++ b/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() diff --git a/upload.sh b/upload.sh new file mode 100755 index 0000000..16e9ef7 --- /dev/null +++ b/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"