Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 4.1.x] [Backport 4.0.x] [Fixes #9041] Docker NGINX listen on ports 80/443 #10343

Merged
merged 1 commit into from
Nov 23, 2022
Merged
Show file tree
Hide file tree
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
12 changes: 3 additions & 9 deletions scripts/docker/nginx/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,14 @@ else
fi

echo "Sanity checks on http/s ports configuration"
if [ -z "${HTTP_PORT}" ]; then
HTTP_PORT=80
fi
if [ -z "${HTTPS_PORT}" ]; then
HTTPS_PORT=443
fi
if [ -z "${JENKINS_HTTP_PORT}" ]; then
JENKINS_HTTP_PORT=9080
fi

echo "Replacing environement variables"
envsubst '\$HTTP_PORT \$HTTPS_PORT \$HTTP_HOST \$HTTPS_HOST \$RESOLVER' < /etc/nginx/nginx.conf.envsubst > /etc/nginx/nginx.conf
envsubst '\$HTTP_PORT \$HTTPS_PORT \$HTTP_HOST \$HTTPS_HOST \$RESOLVER' < /etc/nginx/nginx.https.available.conf.envsubst > /etc/nginx/nginx.https.available.conf
envsubst '\$HTTP_PORT \$HTTPS_PORT \$HTTP_HOST \$HTTPS_HOST \$JENKINS_HTTP_PORT' < /etc/nginx/sites-enabled/geonode.conf.envsubst > /etc/nginx/sites-enabled/geonode.conf
envsubst '\$HTTP_HOST \$HTTPS_HOST \$RESOLVER' < /etc/nginx/nginx.conf.envsubst > /etc/nginx/nginx.conf
envsubst '\$HTTP_HOST \$HTTPS_HOST \$RESOLVER' < /etc/nginx/nginx.https.available.conf.envsubst > /etc/nginx/nginx.https.available.conf
envsubst '\$HTTP_HOST \$HTTPS_HOST \$JENKINS_HTTP_PORT' < /etc/nginx/sites-enabled/geonode.conf.envsubst > /etc/nginx/sites-enabled/geonode.conf

echo "Enabling or not https configuration"
if [ -z "${HTTPS_HOST}" ]; then
Expand Down
6 changes: 3 additions & 3 deletions scripts/docker/nginx/nginx.conf.envsubst
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ http {
# even if not used (HTTP_HOST empty), we must keep it as it's used for internal API calls between django and geoserver
# TODO : do not use unencrypted connection even on LAN, but is it possible to have browser not complaining about unknown authority ?
server {
listen $HTTP_PORT;
listen 80;
server_name $HTTP_HOST 127.0.0.1 geonode;

include sites-enabled/*.conf;
}

# Default server closes the connection (we can connect only using HTTP_HOST and HTTPS_HOST)
server {
listen $HTTP_PORT default_server;
listen $HTTPS_PORT;
listen 80 default_server;
listen 443;
server_name _;
return 444;
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/docker/nginx/nginx.https.available.conf.envsubst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ssl_session_timeout 10m;

# this is the actual HTTPS host
server {
listen $HTTPS_PORT ssl;
listen 443 ssl;
server_name $HTTPS_HOST;
keepalive_timeout 70;

Expand Down