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

- Added nginx support to the installer.

parent e79866fe
...@@ -249,15 +249,21 @@ if($conf['services']['dns'] == true) { ...@@ -249,15 +249,21 @@ if($conf['services']['dns'] == true) {
} }
} }
if($conf['services']['web'] == true) { if($conf['services']['web']) {
//** Configure Apache if($conf['webserver']['server_type'] == 'apache'){
swriteln('Configuring Apache'); //** Configure Apache
$inst->configure_apache(); swriteln('Configuring Apache');
$inst->configure_apache();
//** Configure vlogger
swriteln('Configuring vlogger'); //** Configure vlogger
$inst->configure_vlogger(); swriteln('Configuring vlogger');
$inst->configure_vlogger();
} else {
//** Configure nginx
swriteln('Configuring nginx');
$inst->configure_nginx();
}
//** Configure apps vhost //** Configure apps vhost
swriteln('Configuring Apps vhost'); swriteln('Configuring Apps vhost');
$inst->configure_apps_vhost(); $inst->configure_apps_vhost();
...@@ -305,7 +311,9 @@ if($conf['services']['mail']) { ...@@ -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['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['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['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']) { if($conf['services']['dns']) {
......
...@@ -178,6 +178,21 @@ $conf['jailkit']['jk_chrootsh'] = 'jk_chrootsh.ini'; ...@@ -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_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'; $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 //* vlogger
$conf['vlogger']['config_dir'] = '/etc'; $conf['vlogger']['config_dir'] = '/etc';
......
...@@ -178,6 +178,21 @@ $conf['jailkit']['jk_chrootsh'] = 'jk_chrootsh.ini'; ...@@ -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_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'; $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 //* vlogger
$conf['vlogger']['config_dir'] = '/etc'; $conf['vlogger']['config_dir'] = '/etc';
......
...@@ -192,10 +192,18 @@ $conf['squid']['init_script'] = 'squid'; ...@@ -192,10 +192,18 @@ $conf['squid']['init_script'] = 'squid';
//* Nginx //* Nginx
$conf['nginx']['installed'] = false; // will be detected automatically during installation $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']['config_dir'] = '/etc/nginx';
$conf['nginx']['vhost_conf_dir'] = '/etc/nginx/sites-available'; $conf['nginx']['vhost_conf_dir'] = '/etc/nginx/sites-available';
$conf['nginx']['vhost_conf_enabled_dir'] = '/etc/nginx/sites-enabled'; $conf['nginx']['vhost_conf_enabled_dir'] = '/etc/nginx/sites-enabled';
$conf['nginx']['init_script'] = 'nginx'; $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 //*Ufw
$conf['ufw']['installed'] = false; $conf['ufw']['installed'] = false;
......
...@@ -192,10 +192,18 @@ $conf['squid']['init_script'] = 'squid'; ...@@ -192,10 +192,18 @@ $conf['squid']['init_script'] = 'squid';
//* Nginx //* Nginx
$conf['nginx']['installed'] = false; // will be detected automatically during installation $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']['config_dir'] = '/etc/nginx';
$conf['nginx']['vhost_conf_dir'] = '/etc/nginx/sites-available'; $conf['nginx']['vhost_conf_dir'] = '/etc/nginx/sites-available';
$conf['nginx']['vhost_conf_enabled_dir'] = '/etc/nginx/sites-enabled'; $conf['nginx']['vhost_conf_enabled_dir'] = '/etc/nginx/sites-enabled';
$conf['nginx']['init_script'] = 'nginx'; $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 //* Ufw
$conf['ufw']['installed'] = false; $conf['ufw']['installed'] = false;
......
...@@ -178,6 +178,21 @@ $conf['jailkit']['jk_chrootsh'] = 'jk_chrootsh.ini'; ...@@ -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_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'; $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 //* vlogger
$conf['vlogger']['config_dir'] = '/etc'; $conf['vlogger']['config_dir'] = '/etc';
......
...@@ -194,6 +194,21 @@ $conf['jailkit']['jk_init'] = 'jk_init.ini'; ...@@ -194,6 +194,21 @@ $conf['jailkit']['jk_init'] = 'jk_init.ini';
$conf['jailkit']['jk_chrootsh'] = 'jk_chrootsh.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'; $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 //* vlogger
$conf['vlogger']['config_dir'] = '/etc/vlogger'; $conf['vlogger']['config_dir'] = '/etc/vlogger';
......
...@@ -178,6 +178,21 @@ $conf['jailkit']['jk_chrootsh'] = 'jk_chrootsh.ini'; ...@@ -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_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'; $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 //* vlogger
$conf['vlogger']['config_dir'] = '/etc'; $conf['vlogger']['config_dir'] = '/etc';
......
...@@ -178,6 +178,21 @@ $conf['jailkit']['jk_chrootsh'] = 'jk_chrootsh.ini'; ...@@ -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_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'; $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 //* vlogger
$conf['vlogger']['config_dir'] = '/etc'; $conf['vlogger']['config_dir'] = '/etc';
......
...@@ -157,6 +157,16 @@ if($install_mode == 'standard') { ...@@ -157,6 +157,16 @@ if($install_mode == 'standard') {
//* Create the MySQL database //* Create the MySQL database
$inst->configure_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 //* Insert the Server record into the database
$inst->add_database_server_record(); $inst->add_database_server_record();
...@@ -217,8 +227,16 @@ if($install_mode == 'standard') { ...@@ -217,8 +227,16 @@ if($install_mode == 'standard') {
} }
//* Configure Apache //* Configure Apache
swriteln('Configuring Apache'); if($conf['apache']['installed'] == true){
$inst->configure_apache(); swriteln('Configuring Apache');
$inst->configure_apache();
}
//* Configure nginx
if($conf['nginx']['installed'] == true){
swriteln('Configuring nginx');
$inst->configure_nginx();
}
//** Configure Vlogger //** Configure Vlogger
swriteln('Configuring Vlogger'); swriteln('Configuring Vlogger');
...@@ -248,6 +266,7 @@ if($install_mode == 'standard') { ...@@ -248,6 +266,7 @@ if($install_mode == 'standard') {
$inst->configure_fail2ban(); $inst->configure_fail2ban();
} }
/*
if($conf['squid']['installed'] == true) { if($conf['squid']['installed'] == true) {
$conf['services']['proxy'] = true; $conf['services']['proxy'] = true;
swriteln('Configuring Squid'); swriteln('Configuring Squid');
...@@ -257,6 +276,7 @@ if($install_mode == 'standard') { ...@@ -257,6 +276,7 @@ if($install_mode == 'standard') {
swriteln('Configuring Nginx'); swriteln('Configuring Nginx');
$inst->configure_nginx(); $inst->configure_nginx();
} }
*/
//* Configure ISPConfig //* Configure ISPConfig
swriteln('Installing ISPConfig'); swriteln('Installing ISPConfig');
...@@ -291,7 +311,12 @@ if($install_mode == 'standard') { ...@@ -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['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['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['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['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['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'); 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') { ...@@ -353,6 +378,16 @@ if($install_mode == 'standard') {
//* Create the mysql database //* Create the mysql database
$inst->configure_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 //* Insert the Server record into the database
swriteln('Adding ISPConfig server record to database.'); swriteln('Adding ISPConfig server record to database.');
...@@ -449,6 +484,7 @@ if($install_mode == 'standard') { ...@@ -449,6 +484,7 @@ if($install_mode == 'standard') {
} }
/*
//** Configure Squid //** Configure Squid
if(strtolower($inst->simple_query('Configure Proxy Server', array('y','n'),'y') ) == 'y') { if(strtolower($inst->simple_query('Configure Proxy Server', array('y','n'),'y') ) == 'y') {
if($conf['squid']['installed'] == true) { if($conf['squid']['installed'] == true) {
...@@ -463,21 +499,42 @@ if($install_mode == 'standard') { ...@@ -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'); 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 //** Configure Apache
swriteln("\nHint: If this server shall run the ISPConfig interface, select 'y' in the 'Configure Apache Server' option.\n"); if($conf['apache']['installed'] == true){
if(strtolower($inst->simple_query('Configure Apache Server',array('y','n'),'y')) == 'y') { swriteln("\nHint: If this server shall run the ISPConfig interface, select 'y' in the 'Configure Apache Server' option.\n");
$conf['services']['web'] = true; if(strtolower($inst->simple_query('Configure Apache Server',array('y','n'),'y')) == 'y') {
swriteln('Configuring Apache'); $conf['services']['web'] = true;
$inst->configure_apache(); swriteln('Configuring Apache');
$inst->configure_apache();
//** Configure Vlogger
swriteln('Configuring Vlogger'); //** Configure Vlogger
$inst->configure_vlogger(); swriteln('Configuring Vlogger');
$inst->configure_vlogger();
//** Configure apps vhost
swriteln('Configuring Apps vhost'); //** Configure apps vhost
$inst->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 //** Configure Firewall
...@@ -520,7 +577,10 @@ if($install_mode == 'standard') { ...@@ -520,7 +577,10 @@ if($install_mode == 'standard') {
*/ */
//** Customise the port ISPConfig runs on //** 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') { if(strtolower($inst->simple_query('Enable SSL for the ISPConfig web interface',array('y','n'),'y')) == 'y') {
$inst->make_ispconfig_ssl_cert(); $inst->make_ispconfig_ssl_cert();
...@@ -541,7 +601,12 @@ if($install_mode == 'standard') { ...@@ -541,7 +601,12 @@ if($install_mode == 'standard') {
//* Configure ISPConfig //* Configure ISPConfig
swriteln('Installing ISPConfig crontab'); swriteln('Installing ISPConfig crontab');
$inst->install_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) { ...@@ -633,11 +633,17 @@ function compare_ispconfig_version($current,$new) {
function get_ispconfig_port_number() { function get_ispconfig_port_number() {
global $conf; 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)) { if(is_file($ispconfig_vhost_file)) {
$tmp = file_get_contents($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]); $port_number = intval($matches[1]);
if($port_number > 0) { if($port_number > 0) {
return $port_number; return $port_number;
......
...@@ -234,8 +234,17 @@ class installer_base { ...@@ -234,8 +234,17 @@ class installer_base {
$tpl_ini_array['dns']['named_conf_local_path'] = $conf['bind']['named_conf_local_path']; $tpl_ini_array['dns']['named_conf_local_path'] = $conf['bind']['named_conf_local_path'];
if ($conf['nginx']['installed'] == true) { if ($conf['nginx']['installed'] == true) {
$tpl_ini_array['nginx']['vhost_conf_dir'] = $conf['nginx']['vhost_conf_dir']; $tpl_ini_array['web']['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_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)) { if (array_key_exists('awstats', $conf)) {
...@@ -1109,6 +1118,7 @@ class installer_base { ...@@ -1109,6 +1118,7 @@ class installer_base {
public function configure_apache() { public function configure_apache() {
global $conf; global $conf;
if($conf['apache']['installed'] == false) return;
//* Create the logging directory for the vhost logfiles //* Create the logging directory for the vhost logfiles
if(!@is_dir($conf['ispconfig_log_dir'].'/httpd')) mkdir($conf['ispconfig_log_dir'].'/httpd', 0755, true); if(!@is_dir($conf['ispconfig_log_dir'].'/httpd')) mkdir($conf['ispconfig_log_dir'].'/httpd', 0755, true);
...@@ -1174,9 +1184,36 @@ class installer_base { ...@@ -1174,9 +1184,36 @@ class installer_base {
} }
public function configure_nginx() public function configure_nginx(){
{
global $conf; 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);
}