Skip to content

Commit

Permalink
🔀 Merge pull request #17 from likesistemas/feature/disable-ipv6
Browse files Browse the repository at this point in the history
Disable ipv6 with env vars
  • Loading branch information
ricardoapaes authored May 7, 2024
2 parents 0360ab2 + c2964d2 commit 0e338d7
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
4 changes: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ PHP_FPM_PASSWORD=password_for_fpm_status
FILEBEAT_SETUP=true|false
FILEBEAT_CLOUD_ID=
FILEBEAT_CLOUD_AUTH=
FILEBEAT_NGINX_VERSION=latest
FILEBEAT_NGINX_VERSION=latest
HTTP_IPV6=true|false
HTTPS_IPV6=true|false
2 changes: 0 additions & 2 deletions config/include.d/80.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
listen 80;
listen [::]:80;

include include.d/letsencrypt.conf;
1 change: 0 additions & 1 deletion config/include.d/ssl.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
listen 443 ssl http2;
listen [::]:443 ssl http2;

http2_push_preload on;

Expand Down
15 changes: 15 additions & 0 deletions sh/98-configure-nginx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ cp -R ${SRC_TEMPLATES}/. ${SRC_CONFIG}

PASTA_NGINX_SITE=${SRC_CONFIG}/site.d;
PASTA_NGINX_CONF=${SRC_CONFIG}/conf.d;
PASTA_NGINX_INCLUDE=${SRC_CONFIG}/include.d;

if [ -d "/var/nginx/conf.d/" ]; then
echo "Copiando config extras...";
Expand Down Expand Up @@ -93,5 +94,19 @@ if [ -n "$REALIP_FROM" ]; then
echo "set_real_ip_from ${REALIP_FROM};" >> $REALIP_FROM_CONFIG
fi

if [ -z "$HTTP_IPV6" ] || [ "$HTTP_IPV6" == "true" ]; then
echo "Habilitando IPV6 do HTTP";
echo "listen [::]:80;" >> ${PASTA_NGINX_INCLUDE}/80.conf;

cat ${PASTA_NGINX_INCLUDE}/80.conf;
fi;

if [ -z "$HTTPS_IPV6" ] || [ "$HTTPS_IPV6" == "true" ]; then
echo "Habilitando IPV6 do HTTPS";
echo "listen [::]:443 ssl http2;" >> ${PASTA_NGINX_INCLUDE}/ssl.conf;

cat ${PASTA_NGINX_INCLUDE}/ssl.conf;
fi;

cat ${SRC_CONFIG}/nginx.conf;
cat ${PASTA_NGINX_SITE}/default.conf;

0 comments on commit 0e338d7

Please sign in to comment.