Commit 2dd52148 authored by Marius Burkard's avatar Marius Burkard
Browse files

- added nginx support

parent ca2e5b4f
......@@ -258,11 +258,6 @@ Possible arguments are:
try {
$os = ISPConfigBaseOS::getOSVersion();
if(self::$WEBSERVER === ISPC_WEBSERVER_NGINX) {
ISPConfigLog::error('Nginx install is not yet supported and will be available in a future release.', true);
exit;
}
if(!self::wantsAmavis() && (!isset($_GET['channel']) || $_GET['channel'] !== 'dev')) {
ISPConfigLog::info('<lightred>NOTE:</lightred> Installing ISPConfig stable with rspamd is not supported until 3.1.15 release (due to rspamd support). Please use --channel=dev to install stable-3.1 git development branch or --use-amavis to use amavis instead of rspamd.', true);
exit;
......
......@@ -120,16 +120,18 @@ Alias /phpmyadmin /usr/share/phpmyadmin
Order Deny,Allow
Deny from All
</Directory>';
file_put_contents('/etc/apache2/conf-available/phpmyadmin.conf', $contents);
$cmd = 'a2enconf phpmyadmin';
$result = $this->exec($cmd);
if($result === false) {
throw new ISPConfigOSException('Command ' . $cmd . ' failed.');
if(ISPConfig::$WEBSERVER === ISPC_WEBSERVER_APACHE) {
file_put_contents('/etc/apache2/conf-available/phpmyadmin.conf', $contents);
$cmd = 'a2enconf phpmyadmin';
$result = $this->exec($cmd);
if($result === false) {
throw new ISPConfigOSException('Command ' . $cmd . ' failed.');
}
$this->restartService('apache2');
}
$this->restartService('apache2');
$pma_pass = ISPConfigFunctions::generatePassword(15);
$pma_pass_enc = preg_replace('/[\'\\\\]/', '\\$1', $pma_pass);
......
......@@ -335,13 +335,17 @@ mailman-unsubscribe: "|/var/lib/mailman/mail/mailman unsubscribe mailman"';
throw new ISPConfigOSException('Command ' . $cmd . ' failed.');
}
if(!is_link('/etc/apache2/conf-enabled/mailman.conf') && !is_file('/etc/apache2/conf-enabled/mailman.conf')) {
symlink('/etc/mailman/apache.conf', '/etc/apache2/conf-enabled/mailman.conf');
if(ISPConfig::$WEBSERVER === ISPC_WEBSERVER_APACHE) {
if(!is_link('/etc/apache2/conf-enabled/mailman.conf') && !is_file('/etc/apache2/conf-enabled/mailman.conf')) {
symlink('/etc/mailman/apache.conf', '/etc/apache2/conf-enabled/mailman.conf');
}
}
$this->restartService('postfix');
$this->restartService('mailman');
$this->restartService('apache2');
if(ISPConfig::$WEBSERVER === ISPC_WEBSERVER_APACHE) {
$this->restartService('apache2');
}
return $listpw;
}
......@@ -698,17 +702,34 @@ mailman-unsubscribe: "|/var/lib/mailman/mail/mailman unsubscribe mailman"';
}
if(ISPConfig::shallInstall('web')) {
$packages = array(
'apache2',
'apache2-doc',
'apache2-utils',
'libapache2-mod-fcgid',
'apache2-suexec-pristine',
'libapache2-mod-php',
'libapache2-mod-python',
'libapache2-mod-passenger'
);
$this->stopService('apache2');
$this->stopService('nginx');
if(ISPConfig::$WEBSERVER === ISPC_WEBSERVER_APACHE) {
$packages = array(
'apache2',
'apache2-doc',
'apache2-utils',
'libapache2-mod-fcgid',
'apache2-suexec-pristine',
'libapache2-mod-php',
'libapache2-mod-python',
'libapache2-mod-passenger'
);
} elseif(ISPConfig::$WEBSERVER === ISPC_WEBSERVER_NGINX) {
$packages = array(
'nginx-full',
'fcgiwrap'
);
}
$this->installPackages($packages);
if(ISPConfig::$WEBSERVER === ISPC_WEBSERVER_NGINX) {
$this->stopService('apache2');
$cmd = 'systemctl disable apache2';
$this->exec($cmd); // ignore if this fails
$this->startService('nginx');
}
}
$packages = array(
......@@ -768,7 +789,7 @@ mailman-unsubscribe: "|/var/lib/mailman/mail/mailman unsubscribe mailman"';
}
$this->installPackages($packages);
if(ISPConfig::shallInstall('web')) {
if(ISPConfig::shallInstall('web') && ISPConfig::$WEBSERVER === ISPC_WEBSERVER_APACHE) {
ISPConfigLog::info('Enabling apache modules.', true);
$modules = $this->getApacheModulesToEnable();
$cmd = 'a2enmod ' . implode(' ', $modules) . ' 2>&1';
......@@ -957,14 +978,22 @@ mailman-unsubscribe: "|/var/lib/mailman/mail/mailman unsubscribe mailman"';
);
$result = $this->replaceContents('/etc/roundcube/config.inc.php', $replacements);
$replacements = array(
'/^\s*#*\s*Alias\s+\/roundcube\s+\/var\/lib\/roundcube\s*$/m' => 'Alias /webmail /var/lib/roundcube'
);
$result = $this->replaceContents('/etc/apache2/conf-enabled/roundcube.conf', $replacements);
if(ISPConfig::$WEBSERVER === ISPC_WEBSERVER_APACHE) {
$replacements = array(
'/^\s*#*\s*Alias\s+\/roundcube\s+\/var\/lib\/roundcube\s*$/m' => 'Alias /webmail /var/lib/roundcube'
);
$result = $this->replaceContents('/etc/apache2/conf-enabled/roundcube.conf', $replacements);
} elseif(ISPConfig::$WEBSERVER === ISPC_WEBSERVER_NGINX) {
symlink('/usr/share/roundcube', '/usr/share/squirrelmail');
}
}
if(ISPConfig::shallInstall('web')) {
$this->restartService('apache2');
if(ISPConfig::$WEBSERVER === ISPC_WEBSERVER_APACHE) {
$this->restartService('apache2');
} else {
$this->restartService('nginx');
}
}
ISPConfigLog::info('Installing ISPConfig3.', true);
......@@ -982,7 +1011,7 @@ mailman-unsubscribe: "|/var/lib/mailman/mail/mailman unsubscribe mailman"';
mysql_root_password=' . $mysql_root_pw . '
mysql_database=dbispconfig
mysql_charset=utf8
http_server=apache
http_server=' . (ISPConfig::$WEBSERVER === ISPC_WEBSERVER_APACHE ? 'apache' : 'nginx') . '
ispconfig_port=8080
ispconfig_use_ssl=y
ispconfig_admin_password=' . $ispconfig_admin_pw . '
......@@ -1095,7 +1124,11 @@ mailman-unsubscribe: "|/var/lib/mailman/mail/mailman unsubscribe mailman"';
);
if(ISPConfig::shallInstall('web')) {
$check_services[] = 'pureftpd';
$check_services[] = 'apache2';
if(ISPConfig::$WEBSERVER === ISPC_WEBSERVER_APACHE) {
$check_services[] = 'apache2';
} elseif(ISPConfig::$WEBSERVER === ISPC_WEBSERVER_NGINX) {
$check_services[] = 'nginx';
}
}
if(ISPConfig::shallInstall('mail')) {
if(!ISPConfig::wantsAmavis()) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment