Commit 4ffb51e5 authored by Falko Timme's avatar Falko Timme

- Added nginx support to the installer.

parent e79866fe
......@@ -249,15 +249,21 @@ if($conf['services']['dns'] == true) {
}
}
if($conf['services']['web'] == true) {
//** Configure Apache
swriteln('Configuring Apache');
$inst->configure_apache();
//** Configure vlogger
swriteln('Configuring vlogger');
$inst->configure_vlogger();
if($conf['services']['web']) {
if($conf['webserver']['server_type'] == 'apache'){
//** Configure Apache
swriteln('Configuring Apache');
$inst->configure_apache();
//** Configure vlogger
swriteln('Configuring vlogger');
$inst->configure_vlogger();
} else {
//** Configure nginx
swriteln('Configuring nginx');
$inst->configure_nginx();
}
//** Configure apps vhost
swriteln('Configuring Apps vhost');
$inst->configure_apps_vhost();
......@@ -305,7 +311,9 @@ if($conf['services']['mail']) {
if($conf['mailman']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['mailman']['init_script'])) system($conf['init_scripts'].'/'.$conf['mailman']['init_script'].' restart');
}
if($conf['services']['web']) {
if($conf['apache']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['apache']['init_script'])) system($conf['init_scripts'].'/'.$conf['apache']['init_script'].' restart');
if($conf['webserver']['server_type'] == 'apache' && $conf['apache']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['apache']['init_script'])) system($conf['init_scripts'].'/'.$conf['apache']['init_script'].' restart');
//* Reload is enough for nginx
if($conf['webserver']['server_type'] == 'nginx' && $conf['nginx']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['nginx']['init_script'])) system($conf['init_scripts'].'/'.$conf['nginx']['init_script'].' reload');
if($conf['pureftpd']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['pureftpd']['init_script'])) system($conf['init_scripts'].'/'.$conf['pureftpd']['init_script'].' restart');
}
if($conf['services']['dns']) {
......
......@@ -178,6 +178,21 @@ $conf['jailkit']['jk_chrootsh'] = 'jk_chrootsh.ini';
$conf['jailkit']['jailkit_chroot_app_programs'] = '/usr/bin/groups /usr/bin/id /usr/bin/dircolors /bin/basename /usr/bin/dirname /usr/bin/nano';
$conf['jailkit']['jailkit_chroot_cron_programs'] = '/usr/bin/php /usr/bin/perl /usr/share/perl /usr/share/php';
//* Nginx
$conf['nginx']['installed'] = false; // will be detected automatically during installation
$conf['nginx']['user'] = 'nginx';
$conf['nginx']['group'] = 'nginx';
$conf['nginx']['config_dir'] = '/etc/nginx';
$conf['nginx']['vhost_conf_dir'] = '/etc/nginx/sites-available';
$conf['nginx']['vhost_conf_enabled_dir'] = '/etc/nginx/sites-enabled';
$conf['nginx']['init_script'] = 'nginx';
$conf['nginx']['vhost_port'] = '8080';
$conf['nginx']['cgi_socket'] = '/var/run/fcgiwrap.socket';
$conf['nginx']['php_fpm_init_script'] = 'php5-fpm';
$conf['nginx']['php_fpm_ini_path'] = '/etc/php5/fpm/php.ini';
$conf['nginx']['php_fpm_pool_dir'] = '/etc/php5/fpm/pool.d';
$conf['nginx']['php_fpm_start_port'] = 9010;
//* vlogger
$conf['vlogger']['config_dir'] = '/etc';
......
......@@ -178,6 +178,21 @@ $conf['jailkit']['jk_chrootsh'] = 'jk_chrootsh.ini';
$conf['jailkit']['jailkit_chroot_app_programs'] = '/usr/bin/groups /usr/bin/id /usr/bin/dircolors /bin/basename /usr/bin/dirname /usr/bin/nano';
$conf['jailkit']['jailkit_chroot_cron_programs'] = '/usr/bin/php /usr/bin/perl /usr/share/perl /usr/share/php';
//* Nginx
$conf['nginx']['installed'] = false; // will be detected automatically during installation
$conf['nginx']['user'] = 'nginx';
$conf['nginx']['group'] = 'nginx';
$conf['nginx']['config_dir'] = '/etc/nginx';
$conf['nginx']['vhost_conf_dir'] = '/etc/nginx/sites-available';
$conf['nginx']['vhost_conf_enabled_dir'] = '/etc/nginx/sites-enabled';
$conf['nginx']['init_script'] = 'nginx';
$conf['nginx']['vhost_port'] = '8080';
$conf['nginx']['cgi_socket'] = '/var/run/fcgiwrap.socket';
$conf['nginx']['php_fpm_init_script'] = 'php5-fpm';
$conf['nginx']['php_fpm_ini_path'] = '/etc/php5/fpm/php.ini';
$conf['nginx']['php_fpm_pool_dir'] = '/etc/php5/fpm/pool.d';
$conf['nginx']['php_fpm_start_port'] = 9010;
//* vlogger
$conf['vlogger']['config_dir'] = '/etc';
......
......@@ -192,10 +192,18 @@ $conf['squid']['init_script'] = 'squid';
//* Nginx
$conf['nginx']['installed'] = false; // will be detected automatically during installation
$conf['nginx']['user'] = 'www-data';
$conf['nginx']['group'] = 'www-data';
$conf['nginx']['config_dir'] = '/etc/nginx';
$conf['nginx']['vhost_conf_dir'] = '/etc/nginx/sites-available';
$conf['nginx']['vhost_conf_enabled_dir'] = '/etc/nginx/sites-enabled';
$conf['nginx']['init_script'] = 'nginx';
$conf['nginx']['vhost_port'] = '8080';
$conf['nginx']['cgi_socket'] = '/var/run/fcgiwrap.socket';
$conf['nginx']['php_fpm_init_script'] = 'php5-fpm';
$conf['nginx']['php_fpm_ini_path'] = '/etc/php5/fpm/php.ini';
$conf['nginx']['php_fpm_pool_dir'] = '/etc/php5/fpm/pool.d';
$conf['nginx']['php_fpm_start_port'] = 9010;
//*Ufw
$conf['ufw']['installed'] = false;
......
......@@ -192,10 +192,18 @@ $conf['squid']['init_script'] = 'squid';
//* Nginx
$conf['nginx']['installed'] = false; // will be detected automatically during installation
$conf['nginx']['user'] = 'www-data';
$conf['nginx']['group'] = 'www-data';
$conf['nginx']['config_dir'] = '/etc/nginx';
$conf['nginx']['vhost_conf_dir'] = '/etc/nginx/sites-available';
$conf['nginx']['vhost_conf_enabled_dir'] = '/etc/nginx/sites-enabled';
$conf['nginx']['init_script'] = 'nginx';
$conf['nginx']['vhost_port'] = '8080';
$conf['nginx']['cgi_socket'] = '/var/run/fcgiwrap.socket';
$conf['nginx']['php_fpm_init_script'] = 'php5-fpm';
$conf['nginx']['php_fpm_ini_path'] = '/etc/php5/fpm/php.ini';
$conf['nginx']['php_fpm_pool_dir'] = '/etc/php5/fpm/pool.d';
$conf['nginx']['php_fpm_start_port'] = 9010;
//* Ufw
$conf['ufw']['installed'] = false;
......
......@@ -178,6 +178,21 @@ $conf['jailkit']['jk_chrootsh'] = 'jk_chrootsh.ini';
$conf['jailkit']['jailkit_chroot_app_programs'] = '/usr/bin/groups /usr/bin/id /usr/bin/dircolors /bin/basename /usr/bin/dirname /usr/bin/nano';
$conf['jailkit']['jailkit_chroot_cron_programs'] = '/usr/bin/php /usr/bin/perl /usr/share/perl /usr/share/php';
//* Nginx
$conf['nginx']['installed'] = false; // will be detected automatically during installation
$conf['nginx']['user'] = 'nginx';
$conf['nginx']['group'] = 'nginx';
$conf['nginx']['config_dir'] = '/etc/nginx';
$conf['nginx']['vhost_conf_dir'] = '/etc/nginx/sites-available';
$conf['nginx']['vhost_conf_enabled_dir'] = '/etc/nginx/sites-enabled';
$conf['nginx']['init_script'] = 'nginx';
$conf['nginx']['vhost_port'] = '8080';
$conf['nginx']['cgi_socket'] = '/var/run/fcgiwrap.socket';
$conf['nginx']['php_fpm_init_script'] = 'php5-fpm';
$conf['nginx']['php_fpm_ini_path'] = '/etc/php5/fpm/php.ini';
$conf['nginx']['php_fpm_pool_dir'] = '/etc/php5/fpm/pool.d';
$conf['nginx']['php_fpm_start_port'] = 9010;
//* vlogger
$conf['vlogger']['config_dir'] = '/etc';
......
......@@ -194,6 +194,21 @@ $conf['jailkit']['jk_init'] = 'jk_init.ini';
$conf['jailkit']['jk_chrootsh'] = 'jk_chrootsh.ini';
$conf['jailkit']['jailkit_chroot_app_programs'] = '/bin/groups /usr/bin/id /usr/bin/dircolors /usr/bin/less /usr/bin/basename /usr/bin/dirname /usr/bin/nano /usr/bin/vim';
//* Nginx
$conf['nginx']['installed'] = false; // will be detected automatically during installation
$conf['nginx']['user'] = 'nginx';
$conf['nginx']['group'] = 'nginx';
$conf['nginx']['config_dir'] = '/etc/nginx';
$conf['nginx']['vhost_conf_dir'] = '/etc/nginx/sites-available';
$conf['nginx']['vhost_conf_enabled_dir'] = '/etc/nginx/sites-enabled';
$conf['nginx']['init_script'] = 'nginx';
$conf['nginx']['vhost_port'] = '8080';
$conf['nginx']['cgi_socket'] = '/var/run/fcgiwrap.socket';
$conf['nginx']['php_fpm_init_script'] = 'php5-fpm';
$conf['nginx']['php_fpm_ini_path'] = '/etc/php5/fpm/php.ini';
$conf['nginx']['php_fpm_pool_dir'] = '/etc/php5/fpm/pool.d';
$conf['nginx']['php_fpm_start_port'] = 9010;
//* vlogger
$conf['vlogger']['config_dir'] = '/etc/vlogger';
......
......@@ -178,6 +178,21 @@ $conf['jailkit']['jk_chrootsh'] = 'jk_chrootsh.ini';
$conf['jailkit']['jailkit_chroot_app_programs'] = '/usr/bin/groups /usr/bin/id /usr/bin/dircolors /usr/bin/basename /usr/bin/dirname /usr/bin/nano /usr/bin/pico';
$conf['jailkit']['jailkit_chroot_cron_programs'] = '/usr/bin/php /usr/bin/perl /usr/share/perl /usr/share/php';
//* Nginx
$conf['nginx']['installed'] = false; // will be detected automatically during installation
$conf['nginx']['user'] = 'wwwrun';
$conf['nginx']['group'] = 'www';
$conf['nginx']['config_dir'] = '/etc/nginx';
$conf['nginx']['vhost_conf_dir'] = '/etc/nginx/sites-available';
$conf['nginx']['vhost_conf_enabled_dir'] = '/etc/nginx/sites-enabled';
$conf['nginx']['init_script'] = 'nginx';
$conf['nginx']['vhost_port'] = '8080';
$conf['nginx']['cgi_socket'] = '/var/run/fcgiwrap.socket';
$conf['nginx']['php_fpm_init_script'] = 'php5-fpm';
$conf['nginx']['php_fpm_ini_path'] = '/etc/php5/fpm/php.ini';
$conf['nginx']['php_fpm_pool_dir'] = '/etc/php5/fpm/pool.d';
$conf['nginx']['php_fpm_start_port'] = 9010;
//* vlogger
$conf['vlogger']['config_dir'] = '/etc';
......
......@@ -178,6 +178,21 @@ $conf['jailkit']['jk_chrootsh'] = 'jk_chrootsh.ini';
$conf['jailkit']['jailkit_chroot_app_programs'] = '/usr/bin/groups /usr/bin/id /usr/bin/dircolors /usr/bin/basename /usr/bin/dirname /usr/bin/nano /usr/bin/pico';
$conf['jailkit']['jailkit_chroot_cron_programs'] = '/usr/bin/php /usr/bin/perl /usr/share/perl /usr/share/php';
//* Nginx
$conf['nginx']['installed'] = false; // will be detected automatically during installation
$conf['nginx']['user'] = 'wwwrun';
$conf['nginx']['group'] = 'www';
$conf['nginx']['config_dir'] = '/etc/nginx';
$conf['nginx']['vhost_conf_dir'] = '/etc/nginx/sites-available';
$conf['nginx']['vhost_conf_enabled_dir'] = '/etc/nginx/sites-enabled';
$conf['nginx']['init_script'] = 'nginx';
$conf['nginx']['vhost_port'] = '8080';
$conf['nginx']['cgi_socket'] = '/var/run/fcgiwrap.socket';
$conf['nginx']['php_fpm_init_script'] = 'php5-fpm';
$conf['nginx']['php_fpm_ini_path'] = '/etc/php5/fpm/php.ini';
$conf['nginx']['php_fpm_pool_dir'] = '/etc/php5/fpm/pool.d';
$conf['nginx']['php_fpm_start_port'] = 9010;
//* vlogger
$conf['vlogger']['config_dir'] = '/etc';
......
......@@ -157,6 +157,16 @@ if($install_mode == 'standard') {
//* Create the MySQL database
$inst->configure_database();
//* Configure Webserver - Apache or nginx
if($conf['apache']['installed'] == true && $conf['nginx']['installed'] == true) {
$http_server_to_use = $inst->simple_query('Apache and nginx detected. Select server to use for ISPConfig:', array('apache','nginx'), 'apache');
if($http_server_to_use == 'apache'){
$conf['nginx']['installed'] = false;
} else {
$conf['apache']['installed'] = false;
}
}
//* Insert the Server record into the database
$inst->add_database_server_record();
......@@ -217,8 +227,16 @@ if($install_mode == 'standard') {
}
//* Configure Apache
swriteln('Configuring Apache');
$inst->configure_apache();
if($conf['apache']['installed'] == true){
swriteln('Configuring Apache');
$inst->configure_apache();
}
//* Configure nginx
if($conf['nginx']['installed'] == true){
swriteln('Configuring nginx');
$inst->configure_nginx();
}
//** Configure Vlogger
swriteln('Configuring Vlogger');
......@@ -248,6 +266,7 @@ if($install_mode == 'standard') {
$inst->configure_fail2ban();
}
/*
if($conf['squid']['installed'] == true) {
$conf['services']['proxy'] = true;
swriteln('Configuring Squid');
......@@ -257,6 +276,7 @@ if($install_mode == 'standard') {
swriteln('Configuring Nginx');
$inst->configure_nginx();
}
*/
//* Configure ISPConfig
swriteln('Installing ISPConfig');
......@@ -291,7 +311,12 @@ if($install_mode == 'standard') {
if($conf['courier']['courier-pop-ssl'] != '' && is_executable($conf['init_scripts'].'/'.$conf['courier']['courier-pop-ssl'])) system($conf['init_scripts'].'/'.$conf['courier']['courier-pop-ssl'].' restart');
if($conf['dovecot']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['dovecot']['init_script'])) system($conf['init_scripts'].'/'.$conf['dovecot']['init_script'].' restart');
if($conf['mailman']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['mailman']['init_script'])) system($conf['init_scripts'].'/'.$conf['mailman']['init_script'].' restart');
if($conf['apache']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['apache']['init_script'])) system($conf['init_scripts'].'/'.$conf['apache']['init_script'].' restart');
if($conf['apache']['installed'] == true && $conf['apache']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['apache']['init_script'])) system($conf['init_scripts'].'/'.$conf['apache']['init_script'].' restart');
//* Reload is enough for nginx
if($conf['nginx']['installed'] == true){
if($conf['nginx']['php_fpm_init_script'] != '' && @is_file($conf['init_scripts'].'/'.$conf['nginx']['php_fpm_init_script'])) system($conf['init_scripts'].'/'.$conf['nginx']['php_fpm_init_script'].' reload');
if($conf['nginx']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['nginx']['init_script'])) system($conf['init_scripts'].'/'.$conf['nginx']['init_script'].' reload');
}
if($conf['pureftpd']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['pureftpd']['init_script'])) system($conf['init_scripts'].'/'.$conf['pureftpd']['init_script'].' restart');
if($conf['mydns']['installed'] == true && $conf['mydns']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['mydns']['init_script'])) system($conf['init_scripts'].'/'.$conf['mydns']['init_script'].' restart &> /dev/null');
if($conf['powerdns']['installed'] == true && $conf['powerdns']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['powerdns']['init_script'])) system($conf['init_scripts'].'/'.$conf['powerdns']['init_script'].' restart &> /dev/null');
......@@ -353,6 +378,16 @@ if($install_mode == 'standard') {
//* Create the mysql database
$inst->configure_database();
//* Configure Webserver - Apache or nginx
if($conf['apache']['installed'] == true && $conf['nginx']['installed'] == true) {
$http_server_to_use = $inst->simple_query('Apache and nginx detected. Select server to use for ISPConfig:', array('apache','nginx'), 'apache');
if($http_server_to_use == 'apache'){
$conf['nginx']['installed'] = false;
} else {
$conf['apache']['installed'] = false;
}
}
//* Insert the Server record into the database
swriteln('Adding ISPConfig server record to database.');
......@@ -449,6 +484,7 @@ if($install_mode == 'standard') {
}
/*
//** Configure Squid
if(strtolower($inst->simple_query('Configure Proxy Server', array('y','n'),'y') ) == 'y') {
if($conf['squid']['installed'] == true) {
......@@ -463,21 +499,42 @@ if($install_mode == 'standard') {
if($conf['nginx']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['nginx']['init_script']))system($conf['init_scripts'].'/'.$conf['nginx']['init_script'].' restart &> /dev/null');
}
}
*/
//** Configure Apache
swriteln("\nHint: If this server shall run the ISPConfig interface, select 'y' in the 'Configure Apache Server' option.\n");
if(strtolower($inst->simple_query('Configure Apache Server',array('y','n'),'y')) == 'y') {
$conf['services']['web'] = true;
swriteln('Configuring Apache');
$inst->configure_apache();
//** Configure Vlogger
swriteln('Configuring Vlogger');
$inst->configure_vlogger();
//** Configure apps vhost
swriteln('Configuring Apps vhost');
$inst->configure_apps_vhost();
if($conf['apache']['installed'] == true){
swriteln("\nHint: If this server shall run the ISPConfig interface, select 'y' in the 'Configure Apache Server' option.\n");
if(strtolower($inst->simple_query('Configure Apache Server',array('y','n'),'y')) == 'y') {
$conf['services']['web'] = true;
swriteln('Configuring Apache');
$inst->configure_apache();
//** Configure Vlogger
swriteln('Configuring Vlogger');
$inst->configure_vlogger();
//** Configure apps vhost
swriteln('Configuring Apps vhost');
$inst->configure_apps_vhost();
}
}
//** Configure nginx
if($conf['nginx']['installed'] == true){
swriteln("\nHint: If this server shall run the ISPConfig interface, select 'y' in the 'Configure nginx Server' option.\n");
if(strtolower($inst->simple_query('Configure nginx Server',array('y','n'),'y')) == 'y') {
$conf['services']['web'] = true;
swriteln('Configuring nginx');
$inst->configure_nginx();
//** Configure Vlogger
//swriteln('Configuring Vlogger');
//$inst->configure_vlogger();
//** Configure apps vhost
swriteln('Configuring Apps vhost');
$inst->configure_apps_vhost();
}
}
//** Configure Firewall
......@@ -520,7 +577,10 @@ if($install_mode == 'standard') {
*/
//** Customise the port ISPConfig runs on
$conf['apache']['vhost_port'] = $inst->free_query('ISPConfig Port', '8080');
$ispconfig_vhost_port = $inst->free_query('ISPConfig Port', '8080');
if($conf['apache']['installed'] == true) $conf['apache']['vhost_port'] = $ispconfig_vhost_port;
if($conf['nginx']['installed'] == true) $conf['nginx']['vhost_port'] = $ispconfig_vhost_port;
unset($ispconfig_vhost_port);
if(strtolower($inst->simple_query('Enable SSL for the ISPConfig web interface',array('y','n'),'y')) == 'y') {
$inst->make_ispconfig_ssl_cert();
......@@ -541,7 +601,12 @@ if($install_mode == 'standard') {
//* Configure ISPConfig
swriteln('Installing ISPConfig crontab');
$inst->install_crontab();
if($conf['apache']['init_script'] != '' && @is_file($conf['init_scripts'].'/'.$conf['apache']['init_script'])) system($conf['init_scripts'].'/'.$conf['apache']['init_script'].' restart');
if($conf['apache']['installed'] == true && $conf['apache']['init_script'] != '' && @is_file($conf['init_scripts'].'/'.$conf['apache']['init_script'])) system($conf['init_scripts'].'/'.$conf['apache']['init_script'].' restart');
//* Reload is enough for nginx
if($conf['nginx']['installed'] == true){
if($conf['nginx']['php_fpm_init_script'] != '' && @is_file($conf['init_scripts'].'/'.$conf['nginx']['php_fpm_init_script'])) system($conf['init_scripts'].'/'.$conf['nginx']['php_fpm_init_script'].' reload');
if($conf['nginx']['init_script'] != '' && @is_file($conf['init_scripts'].'/'.$conf['nginx']['init_script'])) system($conf['init_scripts'].'/'.$conf['nginx']['init_script'].' reload');
}
......
......@@ -633,11 +633,17 @@ function compare_ispconfig_version($current,$new) {
function get_ispconfig_port_number() {
global $conf;
$ispconfig_vhost_file = $conf['apache']['vhost_conf_dir'].'/ispconfig.vhost';
if($conf['nginx']['installed'] == true){
$ispconfig_vhost_file = $conf['nginx']['vhost_conf_dir'].'/ispconfig.vhost';
$regex = '/listen (\d+)/';
} else {
$ispconfig_vhost_file = $conf['apache']['vhost_conf_dir'].'/ispconfig.vhost';
$regex = '/\<VirtualHost.*\:(\d{1,})\>/';
}
if(is_file($ispconfig_vhost_file)) {
$tmp = file_get_contents($ispconfig_vhost_file);
preg_match('/\<VirtualHost.*\:(\d{1,})\>/',$tmp,$matches);
preg_match($regex,$tmp,$matches);
$port_number = intval($matches[1]);
if($port_number > 0) {
return $port_number;
......
......@@ -234,8 +234,17 @@ class installer_base {
$tpl_ini_array['dns']['named_conf_local_path'] = $conf['bind']['named_conf_local_path'];
if ($conf['nginx']['installed'] == true) {
$tpl_ini_array['nginx']['vhost_conf_dir'] = $conf['nginx']['vhost_conf_dir'];
$tpl_ini_array['nginx']['vhost_conf_enabled_dir'] = $conf['nginx']['vhost_conf_enabled_dir'];
$tpl_ini_array['web']['nginx_vhost_conf_dir'] = $conf['nginx']['vhost_conf_dir'];
$tpl_ini_array['web']['nginx_vhost_conf_enabled_dir'] = $conf['nginx']['vhost_conf_enabled_dir'];
$tpl_ini_array['web']['nginx_user'] = $conf['nginx']['user'];
$tpl_ini_array['web']['nginx_group'] = $conf['nginx']['group'];
$tpl_ini_array['web']['nginx_cgi_socket'] = $conf['nginx']['cgi_socket'];
$tpl_ini_array['web']['php_fpm_init_script'] = $conf['nginx']['php_fpm_init_script'];
$tpl_ini_array['web']['php_fpm_ini_path'] = $conf['nginx']['php_fpm_ini_path'];
$tpl_ini_array['web']['php_fpm_pool_dir'] = $conf['nginx']['php_fpm_pool_dir'];
$tpl_ini_array['web']['php_fpm_start_port'] = $conf['nginx']['php_fpm_start_port'];
$tpl_ini_array['web']['server_type'] = 'nginx';
$tpl_ini_array['global']['webserver'] = 'nginx';
}
if (array_key_exists('awstats', $conf)) {
......@@ -1109,6 +1118,7 @@ class installer_base {
public function configure_apache() {
global $conf;
if($conf['apache']['installed'] == false) return;
//* Create the logging directory for the vhost logfiles
if(!@is_dir($conf['ispconfig_log_dir'].'/httpd')) mkdir($conf['ispconfig_log_dir'].'/httpd', 0755, true);
......@@ -1174,9 +1184,36 @@ class installer_base {
}
public function configure_nginx()
{
public function configure_nginx(){
global $conf;
if($conf['nginx']['installed'] == false) return;
//* Create the logging directory for the vhost logfiles
if(!@is_dir($conf['ispconfig_log_dir'].'/httpd')) mkdir($conf['ispconfig_log_dir'].'/httpd', 0755, true);
//* make sure that webalizer finds its config file when it is directly in /etc
if(@is_file('/etc/webalizer.conf') && !@is_dir('/etc/webalizer')) {
mkdir('/etc/webalizer');
symlink('/etc/webalizer.conf','/etc/webalizer/webalizer.conf');
}
if(is_file('/etc/webalizer/webalizer.conf')) {
// Change webalizer mode to incremental
replaceLine('/etc/webalizer/webalizer.conf','#IncrementalName','IncrementalName webalizer.current',0,0);
replaceLine('/etc/webalizer/webalizer.conf','#Incremental','Incremental yes',0,0);
replaceLine('/etc/webalizer/webalizer.conf','#HistoryName','HistoryName webalizer.hist',0,0);
}
// Check the awsatst script
if(!is_dir('/usr/share/awstats/tools')) exec('mkdir -p /usr/share/awstats/tools');
if(!file_exists('/usr/share/awstats/tools/awstats_buildstaticpages.pl') && file_exists('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl')) symlink('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl','/usr/share/awstats/tools/awstats_buildstaticpages.pl');
if(file_exists('/etc/awstats/awstats.conf.local')) replaceLine('/etc/awstats/awstats.conf.local','LogFormat=4','LogFormat=1',0,1);
//* add a sshusers group
$command = 'groupadd sshusers';
if(!is_group('sshusers')) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
/*
$row = $this->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = ".$conf["server_id"]."");
$ip_address = gethostbyname($row["server_name"]);
$server_name = $row["server_name"];
......@@ -1204,6 +1241,7 @@ class installer_base {
exec('chown www-data:www-data /var/cache/nginx/cache');
mkdir('/var/cache/nginx/temp');
exec('chown www-data:www-data /var/cache/nginx/temp');
*/
}
public function configure_squid()
......@@ -1325,65 +1363,115 @@ class installer_base {
global $conf;
//* Create the ispconfig apps vhost user and group
if($conf['apache']['installed'] == true){
$apps_vhost_user = escapeshellcmd($conf['web']['apps_vhost_user']);
$apps_vhost_group = escapeshellcmd($conf['web']['apps_vhost_group']);
$install_dir = escapeshellcmd($conf['web']['website_basedir'].'/apps');
$apps_vhost_user = escapeshellcmd($conf['web']['apps_vhost_user']);
$apps_vhost_group = escapeshellcmd($conf['web']['apps_vhost_group']);
$install_dir = escapeshellcmd($conf['web']['website_basedir'].'/apps');
$command = 'groupadd '.$apps_vhost_user;
if(!is_group($apps_vhost_group)) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
$command = 'groupadd '.$apps_vhost_user;
if(!is_group($apps_vhost_group)) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
$command = 'useradd -g '.$apps_vhost_group.' -d '.$install_dir.' '.$apps_vhost_group;
if(!is_user($apps_vhost_user)) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
$command = 'useradd -g '.$apps_vhost_group.' -d '.$install_dir.' '.$apps_vhost_group;
if(!is_user($apps_vhost_user)) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
$command = 'adduser '.$conf['apache']['user'].' '.$apps_vhost_group;
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
$command = 'adduser '.$conf['apache']['user'].' '.$apps_vhost_group;
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
if(!@is_dir($install_dir)) mkdir($install_dir, 0755, true);
chown($install_dir, $apps_vhost_user);
chgrp($install_dir, $apps_vhost_group);
if(!@is_dir($install_dir)) mkdir($install_dir, 0755, true);
chown($install_dir, $apps_vhost_user);
chgrp($install_dir, $apps_vhost_group);
//* Copy the apps vhost file
$vhost_conf_dir = $conf['apache']['vhost_conf_dir'];
$vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir'];
$apps_vhost_servername = ($conf['web']['apps_vhost_servername'] == '')?'':'ServerName '.$conf['web']['apps_vhost_servername'];
//* Copy the apps vhost file
$vhost_conf_dir = $conf['apache']['vhost_conf_dir'];
$vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir'];
$apps_vhost_servername = ($conf['web']['apps_vhost_servername'] == '')?'':'ServerName '.$conf['web']['apps_vhost_servername'];
// Dont just copy over the virtualhost template but add some custom settings
$content = rf('tpl/apache_apps.vhost.master');
// Dont just copy over the virtualhost template but add some custom settings
$content = rf('tpl/apache_apps.vhost.master');
$content = str_replace('{apps_vhost_ip}', $conf['web']['apps_vhost_ip'], $content);
$content = str_replace('{apps_vhost_port}', $conf['web']['apps_vhost_port'], $content);
$content = str_replace('{apps_vhost_dir}', $conf['web']['website_basedir'].'/apps', $content);
$content = str_replace('{website_basedir}', $conf['web']['website_basedir'], $content);
$content = str_replace('{apps_vhost_servername}', $apps_vhost_servername, $content);
$content = str_replace('{apps_vhost_ip}', $conf['web']['apps_vhost_ip'], $content);
$content = str_replace('{apps_vhost_port}', $conf['web']['apps_vhost_port'], $content);
$content = str_replace('{apps_vhost_dir}', $conf['web']['website_basedir'].'/apps', $content);
$content = str_replace('{website_basedir}', $conf['web']['website_basedir'], $content);
$content = str_replace('{apps_vhost_servername}', $apps_vhost_servername, $content);
// comment out the listen directive if port is 80 or 443
if($conf['web']['apps_vhost_ip'] == 80 or $conf['web']['apps_vhost_ip'] == 443) {
$content = str_replace('{vhost_port_listen}', '#', $content);
} else {
$content = str_replace('{vhost_port_listen}', '', $content);
}
// comment out the listen directive if port is 80 or 443
if($conf['web']['apps_vhost_ip'] == 80 or $conf['web']['apps_vhost_ip'] == 443) {
$content = str_replace('{vhost_port_listen}', '#', $content);
} else {
$content = str_replace('{vhost_port_listen}', '', $content);
}
wf($vhost_conf_dir.'/apps.vhost', $content);
wf($vhost_conf_dir.'/apps.vhost', $content);
//copy('tpl/apache_ispconfig.vhost.master', "$vhost_conf_dir/ispconfig.vhost");
//* and create the symlink
if($this->install_ispconfig_interface == true) {
if(@is_link($vhost_conf_enabled_dir.'/apps.vhost')) unlink($vhost_conf_enabled_dir.'/apps.vhost');
if(!@is_link($vhost_conf_enabled_dir.'/000-apps.vhost')) {
symlink($vhost_conf_dir.'/apps.vhost',$vhost_conf_enabled_dir.'/000-apps.vhost');
}
}
if(!is_file($conf['web']['website_basedir'].'/php-fcgi-scripts/apps/.php-fcgi-starter')) {
mkdir($conf['web']['website_basedir'].'/php-fcgi-scripts/apps', 0755, true);
copy('tpl/apache_apps_fcgi_starter.master',$conf['web']['website_basedir'].'/php-fcgi-scripts/apps/.php-fcgi-starter');
exec('chmod +x '.$conf['web']['website_basedir'].'/php-fcgi-scripts/apps/.php-fcgi-starter');