This commit is contained in:
mwiegand 2022-03-06 23:46:50 +01:00
parent fb818b2c74
commit 717811a888

View file

@ -1,3 +1,5 @@
# icingacli setup config webserver nginx --document-root /usr/share/icingaweb2/public --config /etc/icingaweb2 --fpm-uri 127.0.0.1:9000
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
@ -6,65 +8,23 @@ server {
ssl_certificate /var/lib/dehydrated/certs/${server_name}/fullchain.pem;
ssl_certificate_key /var/lib/dehydrated/certs/${server_name}/privkey.pem;
location / {
return 302 /icingaweb2/index.php;
}
root /usr/share/icingaweb2/public;
index index.php index.html index.htm;
location = /favicon.ico {
log_not_found off;
access_log off;
expires max;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
location / {
root /usr/share/icinga/htdocs;
index index.html;
auth_basic "Restricted";
auth_basic_user_file /etc/icinga/htpasswd.users;
}
location /icinga/stylesheets {
alias /etc/icinga/stylesheets;
}
location /stylesheets {
alias /etc/icinga/stylesheets;
}
location /icinga/images {
alias /usr/share/icinga/htdocs/images;
}
location ~ \.cgi$ {
# define root directory for CGIs
root /usr/lib/cgi-bin/icinga;
rewrite ^/icinga/cgi-bin/(.*)\.cgi /$1.cgi break;
rewrite ^/cgi-bin/icinga/(.*)\.cgi /$1.cgi break;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
auth_basic "Restricted";
auth_basic_user_file /etc/icinga/htpasswd.users;
fastcgi_param AUTH_USER $remote_user;
fastcgi_param REMOTE_USER $remote_user;
}
location ~ ^/icinga-api/(.+\.php)$ {
root /usr/share/icinga/htdocs;
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
auth_basic "Restricted";
auth_basic_user_file /etc/icinga/htpasswd.users;
fastcgi_param AUTH_USER $remote_user;
fastcgi_param REMOTE_USER $remote_user;
}
location ~ ^/icingaweb2/index\.php(.*)$ {
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /usr/share/icingaweb2/public/index.php;
fastcgi_param ICINGAWEB_CONFIGDIR /etc/icingaweb2;
fastcgi_param REMOTE_USER $remote_user;
}
location ~ ^/icingaweb2(.+)? {
alias /usr/share/icingaweb2/public;
index index.php;
try_files $1 $uri $uri/ /icingaweb2/index.php$is_args$args;
}
}