nginx子目录到子域icingaweb2

我现在有icinga2与新的icingaweb2用户界面。 它默认为子文件夹/ icingaweb,如下所示:

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; } 

如果我将第一个位置块更改为:

 location / { 

它显示login页面减去所有的CSS。

我怎样才能得到它从一个子域ex前工作。 icinga.example.com?

为了logging我知道的文件的其余部分是正确的,比如server_name,listen root等

提前致谢。

服务器块请求:

 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; } } 

在这里find一个解决scheme – Nginxredirect失败的icingaweb2

第二个地址块中的重写行是什么使魔术发生。

像这样的东西应该在你的情况下工作:

 location ~ ^/index\.php(.*)$ { 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 ~ ^/(.*)? { alias /usr/share/icingaweb/public; index index.php; rewrite ^/$ /dashboard; try_files $1 $uri $uri/ /index.php$is_args$args; }