if ssl section is empty in template data, bind to localhost

pull/6/head
Matthew Strasiotto 4 years ago
parent 3154287c10
commit 2066f90619

@ -34,14 +34,21 @@ stream {
# https://nginx.org/en/docs/stream/ngx_stream_core_module.html#server
# the tty-server tcp connection ssl proxy
server {
listen 3456 ssl so_keepalive=30m::10;
proxy_pass backend;
# If ssl is given
{{#ssl}}
listen 3456 ssl so_keepalive=30m::10;
# proxy_ssl off means terminate ssl here which is good.
proxy_ssl off;
ssl_certificate {{ssl.chain}};
ssl_certificate_key {{ssl.key}};
{{/ssl}}
# proxy_ssl off means terminate ssl here which is good.
proxy_ssl off;
ssl_certificate {{ssl.chain}};
ssl_certificate_key {{ssl.key}};
# If ssl is empty or missing
{{^ssl}}
listen 127.0.0.1:3456;
{{/ssl}}
proxy_pass backend;
access_log /var/log/nginx/stream.log json_combined;
}
}
@ -60,6 +67,8 @@ http {
'"http_user_agent":"$http_user_agent"'
'}';
# if ssl is given
{{#ssl}}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
@ -94,4 +103,19 @@ http {
proxy_buffering off;
}
}
{{/ssl}}
# if ssl is not given
{{^ssl}}
server {
listen 127.0.0.1:80;
server_name {{your_subdomain}};
location / {
proxy_pass http://tty-proxy:8080;
}
}
{{/ssl}}
}

Loading…
Cancel
Save