I currently have icinga2 set up with the new icingaweb2 ui. it defaults to the subfolder /icingaweb as follows:
location ~ ^/icingaweb/index\.php(.*)$ {
# fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /usr/share/icingaweb/public/index.php;
fastcgi_param ICINGAWEB_CONFIGDIR /etc/icingaweb;
}
location ~ ^/icingaweb(.+)? {
alias /usr/share/icingaweb/public;
index index.php;
try_files $1 $uri $uri/ /icingaweb/index.php$is_args$args;
}
If I change the first location block to:
location / {
it shows the login page minus all css.
How can I get it to work off a subdomain ex. icinga.example.com?
For the record the rest of the file I know is formated correctly such as server_name listen root etc.
Thanks in advance.
Server block as requested:
server {
listen 80;
server_name icinga.example.com;
root /usr/share/icingaweb/public;
location ~ ^/icingaweb/index\.php(.*)$ {
# fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /usr/share/icingaweb/public/index.php;
fastcgi_param ICINGAWEB_CONFIGDIR /etc/icingaweb;
}
location ~ ^/icingaweb(.+)? {
alias /usr/share/icingaweb/public;
index index.php;
try_files $1 $uri $uri/ /icingaweb/index.php$is_args$args;
}
}
Best Answer
Found a solution here - Nginx redirect failure for icingaweb2
The rewrite line in the second location block is what makes the magic happen.
Something like this should work in your case: