function Provision_Service_http_https_nginx::save_server in Aegir HTTPS 7.3
File
- submodules/
nginx_https/ drush/ Provision/ Service/ http/ https/ nginx.php, line 51
Class
- Provision_Service_http_https_nginx
- Nginx HTTPS service class.
Code
function save_server() {
// Find nginx executable.
if (provision_file()
->exists('/usr/local/sbin/nginx')
->status()) {
$path = "/usr/local/sbin/nginx";
}
elseif (provision_file()
->exists('/usr/sbin/nginx')
->status()) {
$path = "/usr/sbin/nginx";
}
elseif (provision_file()
->exists('/usr/local/bin/nginx')
->status()) {
$path = "/usr/local/bin/nginx";
}
else {
return;
}
/* TODO: Revisit pretty much everything below this point, as well as the
* duplicates in the base nginx config. We need to find a way to
* re-implement this stuff via proper hooks, etc. rather than optionally
* setting 'basic' mode, etc.*/
// Check if some nginx features are supported and save them for later.
$this->server
->shell_exec($path . ' -V');
$this->server->nginx_is_modern = preg_match("/nginx\\/1\\.((1\\.(8|9|(1[0-9]+)))|((2|3|4|5|6|7|8|9|[1-9][0-9]+)\\.))/", implode('', drush_shell_exec_output()), $match);
$this->server->nginx_has_http2 = preg_match("/http_v2_module/", implode('', drush_shell_exec_output()), $match);
$this->server->nginx_has_upload_progress = preg_match("/upload/", implode('', drush_shell_exec_output()), $match);
$this->server->nginx_has_gzip = preg_match("/http_gzip_static_module/", implode('', drush_shell_exec_output()), $match);
// Use basic nginx configuration if this control file exists.
$nginx_config_mode_file = "/etc/nginx/basic_nginx.conf";
if (provision_file()
->exists($nginx_config_mode_file)
->status()) {
$this->server->nginx_config_mode = 'basic';
drush_log(dt('Basic Nginx Config Active -SAVE- YES control file found @path.', array(
'@path' => $nginx_config_mode_file,
)));
}
else {
$this->server->nginx_config_mode = 'extended';
drush_log(dt('Extended Nginx Config Active -SAVE- NO control file found @path.', array(
'@path' => $nginx_config_mode_file,
)));
}
// Check if there is php-fpm listening on unix socket, otherwise use port 9000 to connect
$this->server->phpfpm_mode = Provision_Service_http_nginx::getPhpFpmMode('save');
// Check if there is BOA specific global.inc file to enable extra Nginx locations
if (provision_file()
->exists('/data/conf/global.inc')
->status()) {
$this->server->satellite_mode = 'boa';
drush_log(dt('BOA mode detected -SAVE- YES file found @path.', array(
'@path' => '/data/conf/global.inc',
)));
}
else {
$this->server->satellite_mode = 'vanilla';
drush_log(dt('Vanilla mode detected -SAVE- NO file found @path.', array(
'@path' => '/data/conf/global.inc',
)));
}
}