Skip to content

Instantly share code, notes, and snippets.

@ep4sh
Forked from vachanda/icinga2.conf
Last active June 28, 2023 14:15
Show Gist options
  • Save ep4sh/5a6139fa9760d356c27f70f6604ccf20 to your computer and use it in GitHub Desktop.
Save ep4sh/5a6139fa9760d356c27f70f6604ccf20 to your computer and use it in GitHub Desktop.
Nginx config for icinga2 web interface with php 7.2 fpm.
server {
listen 8080;
server_name www.icinga.lc;
root /usr/share/icingaweb2/public; #Path of icinga2 web directory
index index.php;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
location = /favicon.ico {
log_not_found off;
access_log off;
expires max;
}
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
location ~ \..*/.*\.php$ {
return 403;
}
if (!-d $request_filename) {
rewrite ^/(.+)/$ /$1 permanent;
}
location / {
try_files $1 $uri $uri/ /index.php$is_args$args;
}
location ~ ^/index\.php(.*)$ {
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; #Replace with the port if php fpm is configured to run on port.
fastcgi_param SCRIPT_FILENAME /usr/share/icingaweb2/public/index.php; #Replace with icinga2 web index.php file path.
fastcgi_param ICINGAWEB_CONFIGDIR /etc/icingaweb2;
fastcgi_param REMOTE_USER $remote_user;
}
}
~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment