From 92df05540b28586fe718a3dd1b74b9da8429dea2 Mon Sep 17 00:00:00 2001 From: William Mantly Date: Fri, 9 Aug 2024 14:45:05 -0400 Subject: [PATCH] Updated nginx files --- ops/install.sh | 8 +++----- ops/nginx_conf/nginx.conf | 1 - ops/nginx_conf/proxy.conf | 2 -- ops/nginx_conf/targetinfo.lua | 2 -- 4 files changed, 3 insertions(+), 10 deletions(-) diff --git a/ops/install.sh b/ops/install.sh index 43cdac5..9398ca3 100644 --- a/ops/install.sh +++ b/ops/install.sh @@ -20,13 +20,9 @@ sudo apt-get update sudo apt-get -y install openresty + sudo luarocks install lua-resty-auto-ssl -sudo luarocks install lua-resty-socket -sudo luarocks install lua-socket -sudo luarocks install socket sudo luarocks install luasocket -sudo luarocks install luasocket-unix -sudo luarocks install lua-cjson mkdir /etc/ssl/ @@ -50,5 +46,7 @@ git clone https://github.com/theta42/proxy.git cd proxy/nodejs npm install +ln -s ops/nginx_conf/targetinfo.lua /usr/local/openresty/lualib/ + systemctl start proxy.service systemctl enable proxy.service diff --git a/ops/nginx_conf/nginx.conf b/ops/nginx_conf/nginx.conf index 2fb1824..95cfb44 100644 --- a/ops/nginx_conf/nginx.conf +++ b/ops/nginx_conf/nginx.conf @@ -28,7 +28,6 @@ http { local targetInfo = require "targetinfo" auto_ssl:set("allow_domain", function(domain) - ngx.log(ngx.ERR, "!!!!!!!!!! allow_domain ", ngx.ctx.toAllow) return ngx.ctx.toAllow end) diff --git a/ops/nginx_conf/proxy.conf b/ops/nginx_conf/proxy.conf index db0ee6e..a728560 100644 --- a/ops/nginx_conf/proxy.conf +++ b/ops/nginx_conf/proxy.conf @@ -26,8 +26,6 @@ server { local scheme = ngx.var.scheme local res = targetInfo.get(ngx, host, ngx.ctx.targetInfo) - ngx.log(ngx.ERR, "!!!!!!!!! after getTargetInfo proxy.conf ", res["ip"]) - if scheme == "http" then if res["forcessl"] == "true" then return ngx.redirect("https://"..host..uri, 301) diff --git a/ops/nginx_conf/targetinfo.lua b/ops/nginx_conf/targetinfo.lua index 3e56558..f71dc1f 100644 --- a/ops/nginx_conf/targetinfo.lua +++ b/ops/nginx_conf/targetinfo.lua @@ -13,7 +13,6 @@ print("In targetInfo module") -- Main function of the module function M.get(ngx, domain, targetInfo) - ngx.log(ngx.ERR, "!!!!!!!!! in targetInfo get") if targetInfo then return targetInfo end @@ -22,7 +21,6 @@ function M.get(ngx, domain, targetInfo) local redis = require "resty.redis" if not domain then - ngx.log(ngx.ERR, "no host header found") ngx.exit(499) return false end