2014-11-06 05:06:55 -05:00
|
|
|
<?php
|
2016-02-08 09:41:00 -05:00
|
|
|
/* Icinga Web 2 | (c) 2014 Icinga Development Team | GPLv2+ */
|
2014-11-06 05:06:55 -05:00
|
|
|
|
2014-11-13 06:50:55 -05:00
|
|
|
namespace Icinga\Module\Setup\Webserver;
|
|
|
|
|
|
|
|
|
|
use Icinga\Module\Setup\Webserver;
|
2014-11-06 05:06:55 -05:00
|
|
|
|
|
|
|
|
/**
|
2014-11-13 06:50:55 -05:00
|
|
|
* Generate nginx configuration
|
2014-11-06 05:06:55 -05:00
|
|
|
*/
|
|
|
|
|
class Nginx extends Webserver
|
|
|
|
|
{
|
2025-05-06 05:35:10 -04:00
|
|
|
protected $fpmUrl = '127.0.0.1:9000';
|
2018-01-18 02:54:35 -05:00
|
|
|
|
2018-12-21 09:29:06 -05:00
|
|
|
protected $enableFpm = true;
|
|
|
|
|
|
2025-05-06 05:35:10 -04:00
|
|
|
protected function createFpmUri()
|
|
|
|
|
{
|
|
|
|
|
return empty($this->fpmSocketPath) ? $this->fpmUrl : $this->fpmSocketSchema . $this->fpmSocketPath;
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-06 05:06:55 -05:00
|
|
|
protected function getTemplate()
|
|
|
|
|
{
|
2014-11-07 03:18:16 -05:00
|
|
|
return <<<'EOD'
|
2014-11-13 08:18:14 -05:00
|
|
|
location ~ ^{urlPath}/index\.php(.*)$ {
|
2018-01-18 02:54:35 -05:00
|
|
|
fastcgi_pass {fpmUri};
|
2014-11-07 03:18:16 -05:00
|
|
|
fastcgi_index index.php;
|
|
|
|
|
include fastcgi_params;
|
2014-11-13 07:16:49 -05:00
|
|
|
fastcgi_param SCRIPT_FILENAME {documentRoot}/index.php;
|
2014-11-13 08:05:13 -05:00
|
|
|
fastcgi_param ICINGAWEB_CONFIGDIR {configDir};
|
2015-03-08 10:22:29 -04:00
|
|
|
fastcgi_param REMOTE_USER $remote_user;
|
2014-11-07 03:18:16 -05:00
|
|
|
}
|
2014-11-06 05:24:41 -05:00
|
|
|
|
2014-11-13 08:18:14 -05:00
|
|
|
location ~ ^{urlPath}(.+)? {
|
2014-11-13 07:16:49 -05:00
|
|
|
alias {documentRoot};
|
2014-11-07 03:18:16 -05:00
|
|
|
index index.php;
|
2014-11-13 08:18:14 -05:00
|
|
|
try_files $1 $uri $uri/ {urlPath}/index.php$is_args$args;
|
2014-11-07 03:18:16 -05:00
|
|
|
}
|
|
|
|
|
EOD;
|
2014-11-06 05:06:55 -05:00
|
|
|
}
|
|
|
|
|
}
|