Created
September 19, 2016 10:15
-
-
Save vachanda/377805c5fd4fac8a8db101e99416d601 to your computer and use it in GitHub Desktop.
Nginx config for icinga2 web interface.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen *:80; | |
server_name www.icinga2.com; | |
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/php5-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; | |
} | |
} |
Super helpful!
Thanks a lot!
I had to add following lines to get around long-taking tasks (e.g. schema upgrades from Icinga2 Director)
location ~ ^/index\.php(.*)$ {
[...]
proxy_connect_timeout 1200s;
proxy_send_timeout 1200s;
proxy_read_timeout 1200s;
fastcgi_send_timeout 1200s;
fastcgi_read_timeout 1200s;
}
can be simplified?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks dude! I was looking for this exactly script!