Add access_log to status and API configuration files (#265)

This commit is contained in:
Alessandro Fael Garcia 2020-06-23 17:48:43 +02:00 committed by GitHub
parent 60796abcd5
commit 77ccf86255
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 1 deletions

View File

@ -315,6 +315,7 @@ nginx_http_template:
nginx_status_enable: false nginx_status_enable: false
nginx_status_location: /etc/nginx/conf.d/stub_status.conf nginx_status_location: /etc/nginx/conf.d/stub_status.conf
nginx_status_port: 80 nginx_status_port: 80
nginx_status_log: false
# Enable NGINX Plus REST API, write access to the REST API, and NGINX Plus dashboard. # Enable NGINX Plus REST API, write access to the REST API, and NGINX Plus dashboard.
# Requires NGINX Plus. # Requires NGINX Plus.
@ -323,6 +324,7 @@ nginx_rest_api_enable: false
nginx_rest_api_template_file: http/api.conf.j2 nginx_rest_api_template_file: http/api.conf.j2
nginx_rest_api_file_location: /etc/nginx/conf.d/api.conf nginx_rest_api_file_location: /etc/nginx/conf.d/api.conf
nginx_rest_api_port: 80 nginx_rest_api_port: 80
nginx_rest_api_log: false
nginx_rest_api_write: false nginx_rest_api_write: false
nginx_rest_api_dashboard: false nginx_rest_api_dashboard: false

View File

@ -47,6 +47,11 @@
- accept_mutex off; - accept_mutex off;
stream_enable: true stream_enable: true
nginx_status_enable: true
nginx_status_location: /etc/nginx/conf.d/stub_status.conf
nginx_status_port: 8080
nginx_status_log: true
nginx_http_template_enable: true nginx_http_template_enable: true
nginx_http_template: nginx_http_template:
app: app:

View File

@ -8,6 +8,7 @@
listen 127.0.0.1:{{ nginx_status_port | default('80') }}; listen 127.0.0.1:{{ nginx_status_port | default('80') }};
location /nginx_status { location /nginx_status {
stub_status on; stub_status on;
access_log {{ nginx_status_log | ternary("on", "off") }};
allow 127.0.0.1; allow 127.0.0.1;
deny all; deny all;
} }
@ -24,6 +25,7 @@
listen 127.0.0.1:{{ nginx_status_port | default('80') }}; listen 127.0.0.1:{{ nginx_status_port | default('80') }};
location /status { location /status {
status; status;
access_log {{ nginx_status_log | ternary("on", "off") }};
allow 127.0.0.1; allow 127.0.0.1;
deny all; deny all;
} }

View File

@ -55,7 +55,6 @@
when: nginx_http_template_enable | bool when: nginx_http_template_enable | bool
notify: "(Handler: All OSs) Reload NGINX" notify: "(Handler: All OSs) Reload NGINX"
- name: "(Setup: All NGINX) Dynamically Generate NGINX API Configuration File" - name: "(Setup: All NGINX) Dynamically Generate NGINX API Configuration File"
template: template:
src: "{{ nginx_rest_api_template_file | default('http/api.conf.j2') }}" src: "{{ nginx_rest_api_template_file | default('http/api.conf.j2') }}"

View File

@ -2,6 +2,7 @@
server { server {
listen {{ nginx_rest_api_port | default('80') }}; listen {{ nginx_rest_api_port | default('80') }};
access_log {{ nginx_rest_api_log | ternary("on", "off") }};
location /api { location /api {
{% if nginx_rest_api_write %} {% if nginx_rest_api_write %}
api write=on; api write=on;