Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion install/nginx-proxy/install-proxy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,15 @@ cd $NGINX_PROXY_AUTOMATION_PATH

# Get current IP Address
NET_INTERFACES=( eth0 ens3 ens4)

# Prefer the host's actual default-route interface so detection works
# regardless of naming (e.g. ens6 on Ubuntu 24.04 / IONOS), then fall back
# to the well-known list above for backward compatibility.
DEFAULT_IFACE=$(ip -4 route show default 2>/dev/null | awk '{print $5; exit}')
[[ -n "$DEFAULT_IFACE" ]] && NET_INTERFACES=( "$DEFAULT_IFACE" "${NET_INTERFACES[@]}" )

for i in "${NET_INTERFACES[@]}"; do
NET_IP=$(ip address show $i | grep "inet\b" | head -n 1 | awk '{print $2}' | cut -d/ -f1)
NET_IP=$(ip address show $i 2>/dev/null | grep "inet\b" | head -n 1 | awk '{print $2}' | cut -d/ -f1)
if [[ $NET_IP =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
break
fi
Expand Down