ansible-nginx/templates/etc/nginx/sites-available/_nagios3.j2

68 lines
1.7 KiB
Plaintext
Raw Normal View History

{% extends "_php.j2" %}
2016-01-15 21:48:18 +07:00
{% block root %}
2016-03-06 00:34:04 +07:00
root {{ nginx_nagios_root }};
2016-01-15 21:48:18 +07:00
{% endblock %}
{% block template_try_files %}
{% endblock %}
{% block template_index %}
index index.php index.html;
{% endblock %}
{% block template_headers %}
# --> Custom headers
{% for key, value in __headers.iteritems() %}
{% if key == "X-Frame-Options" %}
# X-Frame-Options forced by Ansible
2017-02-09 18:30:13 +07:00
add_header {{ key }} "SAMEORIGIN"{% if nginx_version.stdout | version_compare('1.7.5', 'ge') %} always{% endif %};
{% else %}
2017-02-09 18:30:13 +07:00
add_header {{ key }} "{{ value | replace(' always', '') }}"{% if nginx_version.stdout | version_compare('1.7.5', 'ge') and ' always' in value %} always{% endif %};
{% endif %}
{% endfor %}
# <-- Custom headers
{% endblock %}
2016-01-15 21:48:18 +07:00
{% block template_local_content %}
location ~ /\.ht {
deny all;
}
location /stylesheets {
2016-03-06 00:34:04 +07:00
{% if nginx_nagios_stylesheets is defined %}
alias {{ nginx_nagios_stylesheets }};
{% endif %}
2016-01-15 21:48:18 +07:00
expires 60d;
}
{% endblock %}
{% block template_upstream_location %}
2016-03-06 00:34:04 +07:00
{% if ansible_distribution == 'Debian' %}
2016-01-21 21:16:21 +07:00
location /cgi-bin/nagios3 {
root /usr/lib;
2016-03-06 00:34:04 +07:00
{% elif ansible_distribution == 'FreeBSD' %}
location /cgi-bin {
{% endif %}
2016-01-21 21:16:21 +07:00
try_files $uri =404;
{% if nginx_version.stdout | version_compare('1.6.1', 'lt') %}
include fastcgi_params;
{% else %}
include fastcgi.conf;
{% endif %}
2016-03-06 00:34:04 +07:00
fastcgi_pass unix:{{ nginx_fcgiwrap_sock }};
2016-01-15 21:48:18 +07:00
fastcgi_param AUTH_USER $remote_user;
fastcgi_param REMOTE_USER $remote_user;
}
location ~ \.php$ {
fastcgi_pass {{ php_upstream }};
2016-01-15 21:48:18 +07:00
fastcgi_index index.php;
{% if nginx_version.stdout | version_compare('1.6.1', 'lt') %}
include fastcgi_params;
{% else %}
include fastcgi.conf;
{% endif %}
}
{% endblock %}