You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
620 B
30 lines
620 B
worker_processes 1;
|
|
error_log logs/error.log;
|
|
events {
|
|
worker_connections 1024;
|
|
}
|
|
http {
|
|
server {
|
|
listen 8080;
|
|
set $target '';
|
|
location / {
|
|
access_by_lua '
|
|
local t = io.popen("/app/checkPort")
|
|
local a = t:read("*all")
|
|
|
|
if( string.gsub(a,"%D","") == "0" )
|
|
then
|
|
ngx.var.target="http://127.0.0.1:5000"
|
|
else
|
|
ngx.var.target="http://127.0.0.1:3000"
|
|
end
|
|
';
|
|
proxy_pass $target;
|
|
}
|
|
|
|
location ~ /api{
|
|
proxy_pass http://127.0.0.1:2233;
|
|
}
|
|
}
|
|
|
|
} |