feat: Support both http and https for nginx.conf.j2 template
By default, if we do not supply the ssl_certfile and ssl_keyfile, nginx will use http. Change-Id: Iba86cd119e1aeec892c2b663c994778b63767e3e
This commit is contained in:
parent
fb1d6d8d4b
commit
1393aea120
@ -13,11 +13,14 @@ if [[ "${!KOLLA_BOOTSTRAP[*]}" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
GENERATOR_ARGS="--output-file /etc/nginx/nginx.conf"
|
||||
if [[ -n "${LISTEN_ADDRESS}" ]]; then
|
||||
skyline-nginx-generator -o /etc/nginx/nginx.conf --listen-address "${LISTEN_ADDRESS}"
|
||||
else
|
||||
skyline-nginx-generator -o /etc/nginx/nginx.conf
|
||||
GENERATOR_ARGS+=" --listen-address ${LISTEN_ADDRESS}"
|
||||
fi
|
||||
if [[ -n "${SSL_CERTFILE}" ]] && [[ -n "${SSL_KEYFILE}" ]]; then
|
||||
GENERATOR_ARGS+=" --ssl-certfile ${SSL_CERTFILE} --ssl-keyfile ${SSL_KEYFILE}"
|
||||
fi
|
||||
skyline-nginx-generator ${GENERATOR_ARGS}
|
||||
|
||||
nginx
|
||||
|
||||
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
The nginx.conf.j2 support both http and https. By default, if we
|
||||
do not supply the ssl_certfile and ssl_keyfile, nginx will use http.
|
@ -25,7 +25,7 @@ http {
|
||||
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
{% if ssl_certfile and ssl_keyfile %}
|
||||
##
|
||||
# SSL Settings
|
||||
##
|
||||
@ -34,9 +34,9 @@ http {
|
||||
|
||||
# Self signed certs generated by the ssl-cert package
|
||||
# Don't use them in a production server!
|
||||
ssl_certificate {{ ssl_certfile | default('/etc/ssl/certs/ssl-cert-snakeoil.pem') }};
|
||||
ssl_certificate_key {{ ssl_keyfile | default('/etc/ssl/private/ssl-cert-snakeoil.key') }};
|
||||
|
||||
ssl_certificate {{ ssl_certfile }};
|
||||
ssl_certificate_key {{ ssl_keyfile }};
|
||||
{% endif %}
|
||||
##
|
||||
# Logging Settings
|
||||
##
|
||||
@ -69,7 +69,7 @@ http {
|
||||
# Virtual Host Configs
|
||||
##
|
||||
server {
|
||||
listen {{ listen_address | default('0.0.0.0:9999') }} ssl http2 default_server;
|
||||
listen {{ listen_address | default('0.0.0.0:9999') }}{% if ssl_certfile and ssl_keyfile %} ssl http2{% endif %} default_server;
|
||||
|
||||
root {{ skyline_console_static_path }};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user