Enable autoindex in http, server and location namespaces (#75)

* Added condition to use new autoindex variable

* Added condition to use new autoindex variable for separate virtual hosts

* Added global autoindex and autoindex for separate virutal hosts

* Added autoindex enabling for virtual host namespace

* Added autoindex enabling for virtual host namespace variable

* Added autoindex for testing puprposes

* Changed autoindex to false

* Added autoindex for virtual host

* Added autoindex ot readme file
This commit is contained in:
Dmitriy Skopintsev 2018-11-27 01:06:46 +06:00 committed by Alessandro Fael Garcia
parent e9a3e6a8e2
commit df84780f02
5 changed files with 17 additions and 0 deletions

View File

@ -312,6 +312,7 @@ nginx_main_template:
rate_limit: false
keyval: false
stream_enable: false
http_global_autoindex: false
# Enable creating dynamic templated NGINX HTTP configuration files.
# Defaults will not produce a valid configuration. Instead they are meant to showcase
@ -327,6 +328,7 @@ nginx_http_template:
port: 8081
server_name: localhost
error_page: /usr/share/nginx/html
autoindex: false
ssl:
cert: ssl/default.crt
key: ssl/default.key
@ -336,6 +338,7 @@ nginx_http_template:
location: /
html_file_location: /usr/share/nginx/html
html_file_name: index.html
autoindex: false
http_demo_conf: false
load_balancer:
locations:

View File

@ -145,6 +145,7 @@ nginx_main_template:
rate_limit: false
keyval: false
stream_enable: false
http_global_autoindex: false
# Enable creating dynamic templated NGINX HTTP configuration files.
# Defaults will not produce a valid configuration. Instead they are meant to showcase
@ -160,6 +161,7 @@ nginx_http_template:
port: 8081
server_name: localhost
error_page: /usr/share/nginx/html
autoindex: false
ssl:
cert: ssl/default.crt
key: ssl/default.key
@ -169,6 +171,7 @@ nginx_http_template:
location: /
html_file_location: /usr/share/nginx/html
html_file_name: index.html
autoindex: false
http_demo_conf: false
load_balancer:
locations:

View File

@ -23,6 +23,9 @@ server {
listen {{ item.value.port }};
{% endif %}
server_name {{ item.value.server_name }};
{% if item.value.autoindex %}
autoindex on;
{% endif %}
{% if item.value.load_balancer is defined %}
{% for location in item.value.load_balancer.locations %}
location {{ item.value.load_balancer.locations[location].location }} {
@ -43,6 +46,9 @@ server {
location {{ item.value.web_server.locations[location].location }} {
root {{ item.value.web_server.locations[location].html_file_location }};
index {{ item.value.web_server.locations[location].html_file_name }};
{% if item.value.web_server.locations[location].autoindex %}
autoindex on;
{% endif %}
}
{% endfor %}
{% if item.value.web_server.http_demo_conf %}

View File

@ -35,6 +35,9 @@ http {
{% if nginx_main_template.http_settings.keyval %}
keyval_zone zone={{nginx_main_template.http_settings.keyval.zone}}:32k state=one.keyval;
keyval $arg_text $text zone=one;
{% endif %}
{% if nginx_main_template.http_global_autoindex %}
autoindex on;
{% endif %}
include /etc/nginx/conf.d/*.conf;
}

View File

@ -14,10 +14,12 @@
port: 80
server_name: localhost
error_page: /usr/share/nginx/html
autoindex: false
web_server:
locations:
default:
location: /
html_file_location: /usr/share/nginx/html
html_file_name: index.html
autoindex: false
http_demo_conf: false