Merge pull request #377 from wazuh/bugfix-port-80-redirects

Bugfix port 80 redirects
This commit is contained in:
Manuel J. Bernal
2020-09-02 17:05:58 +02:00
committed by GitHub
+20 -1
View File
@@ -52,11 +52,14 @@ if [ "x${KIBANA_HOST}" = "x" ]; then
fi
echo "Configuring NGINX"
if [ "${NGINX_PORT}" = "443" ]; then
cat > /etc/nginx/conf.d/default.conf <<EOF
server {
listen 80;
listen [::]:80;
return 301 https://\$host:${NGINX_PORT}\$request_uri;
return 301 https://\$host\$request_uri;
}
server {
@@ -74,5 +77,21 @@ server {
}
}
EOF
else
cat > /etc/nginx/conf.d/default.conf <<EOF
server {
listen ${NGINX_PORT};
listen [::]:${NGINX_PORT};
location / {
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/conf.d/kibana.htpasswd;
proxy_pass http://${KIBANA_HOST}/;
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
}
}
EOF
fi
exec nginx -g 'daemon off;'