mirror of
https://github.com/CyberL1/dlinux-dashboard.git
synced 2025-01-22 01:19:18 -05:00
37 lines
908 B
Plaintext
37 lines
908 B
Plaintext
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
|
|
server_name code-containers.localhost;
|
|
|
|
location / {
|
|
proxy_pass http://127.0.0.1:3000;
|
|
}
|
|
}
|
|
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
|
|
server_name "~^(port-(?<port>.*)\.)?(?<container>.*)\.code-containers.localhost";
|
|
|
|
location / {
|
|
if ($port = "") {
|
|
set $port "80";
|
|
}
|
|
|
|
set $ip '';
|
|
rewrite_by_lua_block {
|
|
local shell = require("resty.shell")
|
|
|
|
local ok, stdout, strerr, reason, status = shell.run("curl http://127.0.0.1:3000/containers/" .. ngx.var.container .. "/ip")
|
|
ngx.var.ip = stdout
|
|
}
|
|
|
|
proxy_pass http://$ip:$port;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
}
|
|
}
|