Added support for try_files (#117)

* Added support for try_files

* updated try_files for server and web server

* change stream test template port to 81 for travis

* Fix for travis test and localhost error
This commit is contained in:
Tom Gamull 2019-04-04 14:09:42 -04:00 committed by Grzegorz Dzien
parent 1cf74a5d5e
commit 4c96e196d4
3 changed files with 20 additions and 0 deletions

View File

@ -171,6 +171,7 @@ nginx_http_template:
root: /usr/share/nginx/html
https_redirect: false
autoindex: false
try_files: $uri $uri/index.html $uri.html =404
ssl:
cert: /etc/ssl/certs/default.crt
key: /etc/ssl/private/default.key
@ -187,6 +188,7 @@ nginx_http_template:
autoindex: false
auth_basic: null
auth_basic_file: null
try_files: $uri $uri/index.html $uri.html =404
http_demo_conf: false
reverse_proxy:
proxy_cache_path:
@ -238,6 +240,7 @@ nginx_http_template:
websocket: false
auth_basic: null
auth_basic_file: null
try_files: $uri $uri/index.html $uri.html =404
health_check_plus: false
proxy_cache:
proxy_cache_path:

View File

@ -77,6 +77,9 @@ server {
{% if item.value.autoindex is defined and item.value.autoindex %}
autoindex on;
{% endif %}
{% if item.value.try_files is defined %}
try_files {{ item.value.try_files }};
{% endif %}
{% if item.value.reverse_proxy is defined %}
{% for location in item.value.reverse_proxy.locations %}
location {{ item.value.reverse_proxy.locations[location].location }} {
@ -93,6 +96,9 @@ server {
{% if item.value.reverse_proxy.locations[location].proxy_read_timeout is defined and item.value.reverse_proxy.locations[location].proxy_read_timeout %}
proxy_read_timeout {{ item.value.reverse_proxy.locations[location].proxy_read_timeout }};
{% endif %}
{% if item.value.reverse_proxy.locations[location].try_files is defined %}
try_files {{ item.value.reverse_proxy.locations[location].try_files }};
{% endif %}
{% if item.value.reverse_proxy.locations[location].proxy_ssl is defined %}
{% if item.value.reverse_proxy.locations[location].proxy_ssl.cert is defined %}
@ -177,6 +183,9 @@ server {
{% if item.value.web_server.locations[location].autoindex %}
autoindex on;
{% endif %}
{% if item.value.web_server.locations[location].try_files is defined %}
try_files {{ item.value.web_server.locations[location].try_files }};
{% endif %}
{% if item.value.web_server.locations[location].auth_basic is defined and item.value.web_server.locations[location].auth_basic %}
auth_basic "{{ item.value.web_server.locations[location].auth_basic }}";
{% endif %}

View File

@ -22,11 +22,19 @@ upstream {{ item.value.upstreams[upstream].name }} {
{% for stream in item.value.network_streams %}
server {
{% if item.value.network_streams[stream].listen_address is defined and item.value.network_streams[stream].listen_port is defined %}
{% if item.value.network_streams[stream].listen_address == 'localhost' %}
{% if item.value.network_streams[stream].udp_enable %}
listen {{ item.value.network_streams[stream].listen_port }} udp;
{% else %}
listen {{ item.value.network_streams[stream].listen_port }};
{% endif %}
{% else %}
{% if item.value.network_streams[stream].udp_enable %}
listen {{ item.value.network_streams[stream].listen_address }}:{{ item.value.network_streams[stream].listen_port }} udp;
{% else %}
listen {{ item.value.network_streams[stream].listen_address }}:{{ item.value.network_streams[stream].listen_port }};
{% endif %}
{% endif %}
{% elif item.value.network_streams[stream].listen_port is defined %}
{% if item.value.network_streams[stream].udp_enable %}
listen {{ item.value.network_streams[stream].listen_port }} udp;