Updated nginx files
This commit is contained in:
+3
-5
@@ -20,13 +20,9 @@ sudo apt-get update
|
|||||||
|
|
||||||
sudo apt-get -y install openresty
|
sudo apt-get -y install openresty
|
||||||
|
|
||||||
|
|
||||||
sudo luarocks install lua-resty-auto-ssl
|
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
|
||||||
sudo luarocks install luasocket-unix
|
|
||||||
sudo luarocks install lua-cjson
|
|
||||||
|
|
||||||
mkdir /etc/ssl/
|
mkdir /etc/ssl/
|
||||||
|
|
||||||
@@ -50,5 +46,7 @@ git clone https://github.com/theta42/proxy.git
|
|||||||
cd proxy/nodejs
|
cd proxy/nodejs
|
||||||
npm install
|
npm install
|
||||||
|
|
||||||
|
ln -s ops/nginx_conf/targetinfo.lua /usr/local/openresty/lualib/
|
||||||
|
|
||||||
systemctl start proxy.service
|
systemctl start proxy.service
|
||||||
systemctl enable proxy.service
|
systemctl enable proxy.service
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ http {
|
|||||||
local targetInfo = require "targetinfo"
|
local targetInfo = require "targetinfo"
|
||||||
|
|
||||||
auto_ssl:set("allow_domain", function(domain)
|
auto_ssl:set("allow_domain", function(domain)
|
||||||
ngx.log(ngx.ERR, "!!!!!!!!!! allow_domain ", ngx.ctx.toAllow)
|
|
||||||
return ngx.ctx.toAllow
|
return ngx.ctx.toAllow
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|||||||
@@ -26,8 +26,6 @@ server {
|
|||||||
local scheme = ngx.var.scheme
|
local scheme = ngx.var.scheme
|
||||||
local res = targetInfo.get(ngx, host, ngx.ctx.targetInfo)
|
local res = targetInfo.get(ngx, host, ngx.ctx.targetInfo)
|
||||||
|
|
||||||
ngx.log(ngx.ERR, "!!!!!!!!! after getTargetInfo proxy.conf ", res["ip"])
|
|
||||||
|
|
||||||
if scheme == "http" then
|
if scheme == "http" then
|
||||||
if res["forcessl"] == "true" then
|
if res["forcessl"] == "true" then
|
||||||
return ngx.redirect("https://"..host..uri, 301)
|
return ngx.redirect("https://"..host..uri, 301)
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ print("In targetInfo module")
|
|||||||
|
|
||||||
-- Main function of the module
|
-- Main function of the module
|
||||||
function M.get(ngx, domain, targetInfo)
|
function M.get(ngx, domain, targetInfo)
|
||||||
ngx.log(ngx.ERR, "!!!!!!!!! in targetInfo get")
|
|
||||||
if targetInfo then
|
if targetInfo then
|
||||||
return targetInfo
|
return targetInfo
|
||||||
end
|
end
|
||||||
@@ -22,7 +21,6 @@ function M.get(ngx, domain, targetInfo)
|
|||||||
local redis = require "resty.redis"
|
local redis = require "resty.redis"
|
||||||
|
|
||||||
if not domain then
|
if not domain then
|
||||||
ngx.log(ngx.ERR, "no host header found")
|
|
||||||
ngx.exit(499)
|
ngx.exit(499)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user