1
0
mirror of https://github.com/dcarrillo/docker-nginx.git synced 2025-07-01 21:29:25 +00:00

Bump nginx to 1.23.1, Alpine to 3.16 and remove geoip support (#23)

This commit is contained in:
2022-07-25 20:47:36 +02:00
committed by GitHub
parent fb1e810b54
commit 5f90de281b
8 changed files with 6 additions and 95 deletions

Binary file not shown.

View File

@ -41,22 +41,6 @@ http {
ssl_dhparam /tmp/dhparams.pem;
ssl_ecdh_curve secp384r1;
geoip2 /tmp/GeoLite2-Country.mmdb {
auto_reload 24h;
$geoip_country_iso_code country iso_code;
$geoip_country_name country names en;
}
# geoip2 /usr/local/nginx/conf/maxminddb/GeoLite2-City.mmdb {
# auto_reload 24h;
# $geoip_postal_code postal code;
# $geoip_latitude location latitude;
# $geoip_longitude location longitude;
# $geoip_city city names en;
# }
limit_req_zone $binary_remote_addr zone=limited4:10m rate=4r/s;
limit_req_status 429;
@ -69,13 +53,6 @@ http {
server_name _ "";
access_log /dev/fd/1;
location = /ip {
limit_req zone=limited4 burst=5 nodelay;
if ($http_user_agent ~* (?:curl|wget|libwww-perl|python|ansible-httpget|HTTPie|WindowsPowerShell|http_request|^$)) {
return 200 "$remote_addr\n";
}
}
location = /nginx_status {
stub_status on;
}

View File

@ -10,7 +10,7 @@ fi
trap _catch_err ERR
trap _cleanup EXIT
ALPINE_VERSION="alpine:3.11"
ALPINE_VERSION="alpine:3.16"
LOCAL_DIR="$(cd "$(dirname "$0")" ; pwd -P)"
# shellcheck disable=SC1090
. "$LOCAL_DIR"/../conf.env
@ -50,16 +50,6 @@ _check_status_code()
fi
}
_check_if_is_ip()
{
if echo "$1" | grep -E "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$" > /dev/null; then
echo "Test succeeded"
else
printf "Response: %s\nTest failed, response is not an IP\n" "$RESPONSE"
exit 1
fi
}
_setup_crypto_stuff
echo "Preparing dcarrillo/php"
@ -71,7 +61,6 @@ docker exec -i php sh -c "echo 'pm.status_path = /phpfpm_status' \
echo "Running container to be tested..."
docker run --name "${NGINX_VERSION}"_test --rm --link php \
-v "$LOCAL_DIR"/nginx.conf:/usr/local/nginx/conf/nginx.conf:ro \
-v "$LOCAL_DIR"/GeoLite2-Country.mmdb:/tmp/GeoLite2-Country.mmdb:ro \
-v "$TMP_DIR"/cert.pem:/tmp/cert.pem:ro \
-v "$TMP_DIR"/cert.key:/tmp/cert.key:ro \
-v "$TMP_DIR"/dhparams.pem:/tmp/dhparams.pem:ro \
@ -96,10 +85,4 @@ for request in $requests; do
_check_status_code "$STATUS_CODE"
done
## Test 2 request my ip
request="http://${NGINX_VERSION}_test/ip"
printf "\nRequesting %s\n" "$request"
RESPONSE=$($exec_docker curl -s -m 5 "$request" | tr -d '\r')
_check_if_is_ip "$RESPONSE"
echo "All tests succeeded !"