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.
riskshell/conf/nginx.conf

30 lines
620 B

4 years ago
worker_processes 1;
error_log logs/error.log;
events {
worker_connections 1024;
}
http {
server {
listen 8080;
4 years ago
set $target '';
4 years ago
location / {
access_by_lua '
4 years ago
local t = io.popen("/app/checkPort")
local a = t:read("*all")
4 years ago
4 years ago
if( string.gsub(a,"%D","") == "0" )
then
ngx.var.target="http://127.0.0.1:5000"
else
4 years ago
ngx.var.target="http://127.0.0.1:3000"
4 years ago
end
4 years ago
';
4 years ago
proxy_pass $target;
4 years ago
}
4 years ago
location ~ /api{
4 years ago
proxy_pass http://127.0.0.1:2233;
4 years ago
}
4 years ago
}
4 years ago
4 years ago
}