Added ipv6 control script
This commit is contained in:
parent
791c61cabb
commit
3f4b08b8be
@ -64,6 +64,7 @@ COPY --from=builder /build/dist ./
|
|||||||
# manage permissions
|
# manage permissions
|
||||||
RUN chmod 0755 /docker-entrypoint.d/*.sh /etc/nginx/templates && \
|
RUN chmod 0755 /docker-entrypoint.d/*.sh /etc/nginx/templates && \
|
||||||
chmod -R 0644 /etc/nginx/nginx.conf && \
|
chmod -R 0644 /etc/nginx/nginx.conf && \
|
||||||
chown -R nginx:nginx ./ /etc/nginx/conf.d /etc/nginx/templates
|
chown -R nginx:nginx ./ /etc/nginx/conf.d /etc/nginx/templates && \
|
||||||
|
rm -f /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
|
||||||
# unprivileged user
|
# unprivileged user
|
||||||
USER nginx
|
USER nginx
|
||||||
|
@ -1,13 +1,19 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
DEFAULT_CONF_FILE="etc/nginx/conf.d/default.conf"
|
if [ ! -f "/proc/net/if_inet6" ]; then
|
||||||
|
echo "info: IPv6 is not available! Removing IPv6 listen configuration"
|
||||||
if [ -f "/proc/net/if_inet6" ]; then
|
find /etc/nginx/conf.d -name '*.conf' -type f | \
|
||||||
echo "info: IPv6 available."
|
while IFS= read -r CONFIG; do
|
||||||
exit 0
|
sed -r '/^\s*listen\s*\[::\]:.+$/d' "$CONFIG" > "$CONFIG.temp"
|
||||||
|
if ! diff -U 5 "$CONFIG" "$CONFIG.temp" > "$CONFIG.diff"; then
|
||||||
|
echo "info: Removing IPv6 lines from $CONFIG" | \
|
||||||
|
cat - "$CONFIG.diff"
|
||||||
|
echo "# IPv6 is disabled because /proc/net/if_inet6 was not found" | \
|
||||||
|
cat - "$CONFIG.temp" > "$CONFIG"
|
||||||
|
else
|
||||||
|
echo "info: Skipping $CONFIG because it does not have IPv6 listen"
|
||||||
|
fi
|
||||||
|
rm -f "$CONFIG.temp" "$CONFIG.diff"
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "info: IPv6 not available!"
|
|
||||||
echo "info: Removing IPv6 lines from /$DEFAULT_CONF_FILE"
|
|
||||||
sed -i 's/\(listen\s*\[::\].*\)$/#\1 # Disabled IPv6/' /${DEFAULT_CONF_FILE}
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
server {
|
server {
|
||||||
listen ${VIKUNJA_HTTP_PORT};
|
listen ${VIKUNJA_HTTP_PORT};
|
||||||
listen [::]:${VIKUNJA_HTTP_PORT};
|
listen [::]:${VIKUNJA_HTTP_PORT};
|
||||||
## Needed when behind HAProxy with SSL termination + HTTP/2 support
|
## Needed when behind HAProxy with SSL termination + HTTP/2 support
|
||||||
listen ${VIKUNJA_HTTP2_PORT} default_server http2 proxy_protocol;
|
listen ${VIKUNJA_HTTP2_PORT} default_server http2 proxy_protocol;
|
||||||
listen [::]:${VIKUNJA_HTTP2_PORT} default_server http2 proxy_protocol;
|
listen [::]:${VIKUNJA_HTTP2_PORT} default_server http2 proxy_protocol;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user