Set-OPS-Public/roles/serveur_icingaweb2/templates/nginx.conf.j2

46 lines
1.9 KiB
Text
Raw Normal View History

# Géré par Set-OPS (rôle serveur_icingaweb2). Ne pas éditer à la main.
# nginx LOCAL : sert Icinga Web 2 (PHP-FPM). L'edge nginx proxifie par nom vers ce port.
server {
listen {{ serveur_icingaweb2_nginx_bind }}{{ serveur_icingaweb2_http_port }};
{% if not serveur_icingaweb2_nginx_bind %}
listen [::]:{{ serveur_icingaweb2_http_port }};
{% endif %}
server_name {{ serveur_icingaweb2_hostname }};
root {{ serveur_icingaweb2_docroot }};
index index.php;
{% if serveur_icingaweb2_auth == 'locale' %}
# MODE `locale` : C'EST NGINX QUI AUTHENTIFIE.
#
# Icinga Web 2 n'a pas d'OIDC natif et un SITE n'a ni annuaire ni passerelle SSO.
# HTTP Basic devant `external` est le contrat que l'application attend deja — le
# serveur web dit QUI, l'application le croit. C'est exactement ce que fait
# oauth2-proxy chez un locataire, avec un vestibule plus simple.
#
# AU NIVEAU DU `server`, PAS DU `location` : place dans le seul bloc PHP, la
# protection sauterait tout ce que `try_files` sert directement — feuilles de style,
# icones, et surtout les fichiers que `location ~ /\.ht` croit couvrir. Une
# authentification qu'on peut contourner par un chemin voisin n'en est pas une.
auth_basic "{{ serveur_icingaweb2_realm }}";
auth_basic_user_file {{ serveur_icingaweb2_htpasswd }};
{% endif %}
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ ^/index\.php {
fastcgi_pass unix:{{ serveur_icingaweb2_php_fpm_socket }};
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME {{ serveur_icingaweb2_docroot }}/index.php;
fastcgi_param ICINGAWEB_CONFIGDIR {{ serveur_icingaweb2_config_dir }};
fastcgi_param REMOTE_USER {{ serveur_icingaweb2_remote_user }};
}
location ~ /\.ht {
deny all;
}
}