Skip to content

Commit 53b953f

Browse files
committed
Get latest version from nginx.org
- Set default to latest version from nginx.org
1 parent da89d6c commit 53b953f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

nginx-autoinstall.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,17 @@ if [[ $EUID -ne 0 ]]; then
66
exit 1
77
fi
88

9+
# Get latest version from nginx.org
10+
curl_request() {
11+
curl -s https://nginx.org/en/download.html |
12+
grep -oP "(?<="$1" version).*?(?=[0-9]+\.[0-9]+\.[0-9](-[0-9])?</a)" |
13+
grep -oP "[0-9]+\.[0-9]+\.[0-9](-[0-9])?"
14+
}
15+
latest_mainline=$(curl_request Mainline)
16+
latest_stable=$(curl_request Stable)
917
# Define versions
10-
NGINX_MAINLINE_VER=${NGINX_MAINLINE_VER:-1.21.6}
11-
NGINX_STABLE_VER=${NGINX_STABLE_VER:-1.22.0}
18+
NGINX_MAINLINE_VER=${NGINX_MAINLINE_VER:-$latest_mainline}
19+
NGINX_STABLE_VER=${NGINX_STABLE_VER:-$latest_stable}
1220
LIBRESSL_VER=${LIBRESSL_VER:-3.3.1}
1321
OPENSSL_VER=${OPENSSL_VER:-1.1.1l}
1422
NPS_VER=${NPS_VER:-1.13.35.2}

0 commit comments

Comments
 (0)