diff --git a/install/autoupdate.php b/install/autoupdate.php index 48ee59860e54e588df422ad39d30be6a6e33448b..b77ff49b388c24639561e725b1c90b752774cacc 100644 --- a/install/autoupdate.php +++ b/install/autoupdate.php @@ -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']) { diff --git a/install/dist/conf/centos52.conf.php b/install/dist/conf/centos52.conf.php index 8ff03ce603002d667cba2985824a234ebf5a43c4..3b95c7b48edf785f1466d2c41e5d8de54e522c76 100644 --- a/install/dist/conf/centos52.conf.php +++ b/install/dist/conf/centos52.conf.php @@ -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'; diff --git a/install/dist/conf/centos53.conf.php b/install/dist/conf/centos53.conf.php index 8ff03ce603002d667cba2985824a234ebf5a43c4..3b95c7b48edf785f1466d2c41e5d8de54e522c76 100644 --- a/install/dist/conf/centos53.conf.php +++ b/install/dist/conf/centos53.conf.php @@ -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'; diff --git a/install/dist/conf/debian40.conf.php b/install/dist/conf/debian40.conf.php index e635b1fa5b0c43587f239e4b9609075097478633..b884a89da246ab060f421485e3ca69d9278573fb 100644 --- a/install/dist/conf/debian40.conf.php +++ b/install/dist/conf/debian40.conf.php @@ -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; diff --git a/install/dist/conf/debian60.conf.php b/install/dist/conf/debian60.conf.php index d1801f05d5f3d759d4df4ad05805b964a1a9af65..4af85b80c5a837ed1d71291db845bcc1c6ea57a5 100644 --- a/install/dist/conf/debian60.conf.php +++ b/install/dist/conf/debian60.conf.php @@ -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; diff --git a/install/dist/conf/fedora9.conf.php b/install/dist/conf/fedora9.conf.php index ea1affa73732844f209696aee8f3feb96c095094..86f6ecbdbbd0d4e7e0745ab0c4221e66372f7278 100644 --- a/install/dist/conf/fedora9.conf.php +++ b/install/dist/conf/fedora9.conf.php @@ -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'; diff --git a/install/dist/conf/gentoo.conf.php b/install/dist/conf/gentoo.conf.php index cfb20a432d1fcb8d5d99de5ce95822e8cdfd6ea1..8ed4fee96a9c56db767221a85bed2c7c25d4e9f9 100644 --- a/install/dist/conf/gentoo.conf.php +++ b/install/dist/conf/gentoo.conf.php @@ -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'; diff --git a/install/dist/conf/opensuse110.conf.php b/install/dist/conf/opensuse110.conf.php index 5839c054b914ef653e0a16590d4d20f6a1ad3fd7..9e16773fecbface7c8db42e1cd7965da51a8d48e 100644 --- a/install/dist/conf/opensuse110.conf.php +++ b/install/dist/conf/opensuse110.conf.php @@ -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'; diff --git a/install/dist/conf/opensuse112.conf.php b/install/dist/conf/opensuse112.conf.php index 88c1c6e6975c891b88eeeefc41cce6854017ff46..ac95961bbd8c84620335931a5b474f4b5f3ea785 100644 --- a/install/dist/conf/opensuse112.conf.php +++ b/install/dist/conf/opensuse112.conf.php @@ -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'; diff --git a/install/install.php b/install/install.php index e2975c99a3496f3eeda8155e2d0c187a33d25dd3..341721583e2223a9380857357313a362006fbd31 100644 --- a/install/install.php +++ b/install/install.php @@ -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'); + } diff --git a/install/lib/install.lib.php b/install/lib/install.lib.php index 4ef2d37758ec715a3c130fcf6170e0a7faa07993..318cda923e0e76500b3e8f11914fbd2eb04ba77c 100644 --- a/install/lib/install.lib.php +++ b/install/lib/install.lib.php @@ -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 = '/\/'; + } + if(is_file($ispconfig_vhost_file)) { $tmp = file_get_contents($ispconfig_vhost_file); - preg_match('/\/',$tmp,$matches); + preg_match($regex,$tmp,$matches); $port_number = intval($matches[1]); if($port_number > 0) { return $port_number; diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php index 08e46496be02386721e2a2922359c27411506dc7..b69912befabeb67e5ad124eaccbe5bface2cf3d5 100644 --- a/install/lib/installer_base.lib.php +++ b/install/lib/installer_base.lib.php @@ -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'); + exec('chown -R ispapps:ispapps '.$conf['web']['website_basedir'].'/php-fcgi-scripts/apps'); - //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'); - exec('chown -R ispapps:ispapps '.$conf['web']['website_basedir'].'/php-fcgi-scripts/apps'); + if($conf['nginx']['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'); - } + $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 = 'adduser '.$conf['nginx']['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); + + //* Copy the apps vhost file + $vhost_conf_dir = $conf['nginx']['vhost_conf_dir']; + $vhost_conf_enabled_dir = $conf['nginx']['vhost_conf_enabled_dir']; + $apps_vhost_servername = ($conf['web']['apps_vhost_servername'] == '')?'_':$conf['web']['apps_vhost_servername']; + + // Dont just copy over the virtualhost template but add some custom settings + $content = rf('tpl/nginx_apps.vhost.master'); + + if($conf['web']['apps_vhost_ip'] == '_default_'){ + $apps_vhost_ip = ''; + } else { + $apps_vhost_ip = $conf['web']['apps_vhost_ip'].':'; + } + + $content = str_replace('{apps_vhost_ip}', $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('{apps_vhost_servername}', $apps_vhost_servername, $content); + $content = str_replace('{fpm_port}', $conf['nginx']['php_fpm_start_port'], $content); + + wf($vhost_conf_dir.'/apps.vhost', $content); + + //copy('tpl/nginx_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'); + } + } + } } public function make_ispconfig_ssl_cert() { @@ -1522,6 +1610,8 @@ class installer_base { if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { + if($conf['apache']['installed'] == true && $file == 'nginx_plugin.inc.php') continue; + if($conf['nginx']['installed'] == true && $file == 'apache2_plugin.inc.php') continue; if($file != '.' && $file != '..' && substr($file,-8,8) == '.inc.php') { include_once($install_dir.'/server/plugins-available/'.$file); $plugin_name = substr($file,0,-8); @@ -1624,45 +1714,90 @@ class installer_base { $command = "chmod +x $install_dir/server/scripts/*.sh"; caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); - //* Copy the ISPConfig vhost for the controlpanel - $vhost_conf_dir = $conf['apache']['vhost_conf_dir']; - $vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir']; - + if($conf['apache']['installed'] == true){ + //* Copy the ISPConfig vhost for the controlpanel + $vhost_conf_dir = $conf['apache']['vhost_conf_dir']; + $vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir']; - // Dont just copy over the virtualhost template but add some custom settings - $content = rf('tpl/apache_ispconfig.vhost.master'); - $content = str_replace('{vhost_port}', $conf['apache']['vhost_port'], $content); + // Dont just copy over the virtualhost template but add some custom settings + $content = rf('tpl/apache_ispconfig.vhost.master'); + $content = str_replace('{vhost_port}', $conf['apache']['vhost_port'], $content); - // comment out the listen directive if port is 80 or 443 - if($conf['apache']['vhost_port'] == 80 or $conf['apache']['vhost_port'] == 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['apache']['vhost_port'] == 80 or $conf['apache']['vhost_port'] == 443) { + $content = str_replace('{vhost_port_listen}', '#', $content); + } else { + $content = str_replace('{vhost_port_listen}', '', $content); + } - if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key')) { - $content = str_replace('{ssl_comment}', '', $content); - } else { - $content = str_replace('{ssl_comment}', '#', $content); - } + if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key')) { + $content = str_replace('{ssl_comment}', '', $content); + } else { + $content = str_replace('{ssl_comment}', '#', $content); + } - wf($vhost_conf_dir.'/ispconfig.vhost', $content); + wf($vhost_conf_dir.'/ispconfig.vhost', $content); + + //copy('tpl/apache_ispconfig.vhost.master', $vhost_conf_dir.'/ispconfig.vhost'); + //* and create the symlink + if($this->install_ispconfig_interface == true && $this->is_update == false) { + if(@is_link($vhost_conf_enabled_dir.'/ispconfig.vhost')) unlink($vhost_conf_enabled_dir.'/ispconfig.vhost'); + if(!@is_link($vhost_conf_enabled_dir.'/000-ispconfig.vhost')) { + symlink($vhost_conf_dir.'/ispconfig.vhost',$vhost_conf_enabled_dir.'/000-ispconfig.vhost'); + } + } + if(!is_file('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter')) { + mkdir('/var/www/php-fcgi-scripts/ispconfig', 0755, true); + copy('tpl/apache_ispconfig_fcgi_starter.master','/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter'); + exec('chmod +x /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter'); + symlink($install_dir.'/interface/web','/var/www/ispconfig'); + exec('chown -R ispconfig:ispconfig /var/www/php-fcgi-scripts/ispconfig'); - //copy('tpl/apache_ispconfig.vhost.master', $vhost_conf_dir.'/ispconfig.vhost'); - //* and create the symlink - if($this->install_ispconfig_interface == true && $this->is_update == false) { - if(@is_link($vhost_conf_enabled_dir.'/ispconfig.vhost')) unlink($vhost_conf_enabled_dir.'/ispconfig.vhost'); - if(!@is_link($vhost_conf_enabled_dir.'/000-ispconfig.vhost')) { - symlink($vhost_conf_dir.'/ispconfig.vhost',$vhost_conf_enabled_dir.'/000-ispconfig.vhost'); } } - if(!is_file('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter')) { - mkdir('/var/www/php-fcgi-scripts/ispconfig', 0755, true); - copy('tpl/apache_ispconfig_fcgi_starter.master','/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter'); - exec('chmod +x /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter'); - symlink($install_dir.'/interface/web','/var/www/ispconfig'); - exec('chown -R ispconfig:ispconfig /var/www/php-fcgi-scripts/ispconfig'); + + if($conf['nginx']['installed'] == true){ + //* Copy the ISPConfig vhost for the controlpanel + $vhost_conf_dir = $conf['nginx']['vhost_conf_dir']; + $vhost_conf_enabled_dir = $conf['nginx']['vhost_conf_enabled_dir']; + + // Dont just copy over the virtualhost template but add some custom settings + $content = rf('tpl/nginx_ispconfig.vhost.master'); + $content = str_replace('{vhost_port}', $conf['nginx']['vhost_port'], $content); + + if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key')) { + $content = str_replace('{ssl_on}', ' ssl', $content); + $content = str_replace('{ssl_comment}', '', $content); + $content = str_replace('{fastcgi_ssl}', 'on', $content); + } else { + $content = str_replace('{ssl_on}', '', $content); + $content = str_replace('{ssl_comment}', '#', $content); + $content = str_replace('{fastcgi_ssl}', 'off', $content); + } + + $content = str_replace('{fpm_port}', $conf['nginx']['php_fpm_start_port'], $content); + wf($vhost_conf_dir.'/ispconfig.vhost', $content); + + unset($content); + + // PHP-FPM + // Dont just copy over the php-fpm pool template but add some custom settings + $content = rf('tpl/php_fpm_pool.conf.master'); + $content = str_replace('{fpm_pool}', 'ispconfig', $content); + $content = str_replace('{fpm_port}', $conf['nginx']['php_fpm_start_port'], $content); + $content = str_replace('{fpm_user}', 'ispconfig', $content); + $content = str_replace('{fpm_group}', 'ispconfig', $content); + wf($conf['nginx']['php_fpm_pool_dir'].'/ispconfig.conf', $content); + + //copy('tpl/nginx_ispconfig.vhost.master', $vhost_conf_dir.'/ispconfig.vhost'); + //* and create the symlink + if($this->install_ispconfig_interface == true && $this->is_update == false) { + if(@is_link($vhost_conf_enabled_dir.'/ispconfig.vhost')) unlink($vhost_conf_enabled_dir.'/ispconfig.vhost'); + if(!@is_link($vhost_conf_enabled_dir.'/000-ispconfig.vhost')) { + symlink($vhost_conf_dir.'/ispconfig.vhost',$vhost_conf_enabled_dir.'/000-ispconfig.vhost'); + } + } } //* Install the update script diff --git a/install/lib/update.lib.php b/install/lib/update.lib.php index 4a1af3a181421b87634d61bd13c7eee9b8866637..fc4a5e3ebc78eab170a86f8538b4137621ea6e36 100644 --- a/install/lib/update.lib.php +++ b/install/lib/update.lib.php @@ -126,6 +126,18 @@ function updateDbAndIni() { $conf['postfix']['vmail_mailbox_base'] = $ini_array['mail']['homedir_path']; + if($ini_array['web']['server_type'] != ''){ + $conf['webserver']['server_type'] = $ini_array['web']['server_type']; + if($conf['webserver']['server_type'] == 'nginx'){ + $conf['apache']['installed'] = false; + } else { + $conf['nginx']['installed'] = false; + } + } else { + $conf['webserver']['server_type'] = 'apache'; + $conf['nginx']['installed'] = false; + } + //* Do incremental DB updates only on installed ISPConfig versions > 3.0.3 if(compare_ispconfig_version('3.0.3',ISPC_APP_VERSION) >= 0) { @@ -226,8 +238,6 @@ function updateDbAndIni() { //* Update further distribution specific parameters for server config here //* HINT: Every line added here has to be added in installer_base.lib.php too!! - $tpl_ini_array['web']['vhost_conf_dir'] = $conf['apache']['vhost_conf_dir']; - $tpl_ini_array['web']['vhost_conf_enabled_dir'] = $conf['apache']['vhost_conf_enabled_dir']; $tpl_ini_array['jailkit']['jailkit_chroot_app_programs'] = $conf['jailkit']['jailkit_chroot_app_programs']; $tpl_ini_array['fastcgi']['fastcgi_phpini_path'] = $conf['fastcgi']['fastcgi_phpini_path']; $tpl_ini_array['fastcgi']['fastcgi_starter_path'] = $conf['fastcgi']['fastcgi_starter_path']; @@ -249,6 +259,20 @@ function updateDbAndIni() { $tpl_ini_array['dns']['bind_zonefiles_dir'] = $conf['bind']['bind_zonefiles_dir']; $tpl_ini_array['dns']['named_conf_path'] = $conf['bind']['named_conf_path']; $tpl_ini_array['dns']['named_conf_local_path'] = $conf['bind']['named_conf_local_path']; + + if ($conf['nginx']['installed'] == true) { + $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'; + } // update the new template with the old values if(is_array($old_ini_array)) { diff --git a/install/tpl/nginx_apps.vhost.master b/install/tpl/nginx_apps.vhost.master new file mode 100644 index 0000000000000000000000000000000000000000..30416e3e3a479e4f2a1c632c62e39a1a7e100bd2 --- /dev/null +++ b/install/tpl/nginx_apps.vhost.master @@ -0,0 +1,28 @@ +server { + listen {apps_vhost_ip}{apps_vhost_port}; + + server_name {apps_vhost_servername}; + + root {apps_vhost_dir}; + + location / { + index index.php index.html; + } + + # serve static files directly + location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt)$ { + access_log off; + } + + location ~ \.php$ { + fastcgi_pass 127.0.0.1:{fpm_port}; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $fastcgi_script_name; + include /etc/nginx/fastcgi_params; + } + + location ~ /\. { + deny all; + } +} \ No newline at end of file diff --git a/install/tpl/nginx_ispconfig.vhost.master b/install/tpl/nginx_ispconfig.vhost.master new file mode 100644 index 0000000000000000000000000000000000000000..ab0c6e482cc07c4d60d244d3b97439a1bf27e3df --- /dev/null +++ b/install/tpl/nginx_ispconfig.vhost.master @@ -0,0 +1,46 @@ +server { + listen {vhost_port}{ssl_on}; + {ssl_comment}ssl_certificate /usr/local/ispconfig/interface/ssl/ispserver.crt; + {ssl_comment}ssl_certificate_key /usr/local/ispconfig/interface/ssl/ispserver.key; + + server_name _; + + root /usr/local/ispconfig/interface/web/; + + location / { + index index.php index.html; + } + + # serve static files directly + location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt)$ { + access_log off; + } + + location ~ \.php$ { + fastcgi_pass 127.0.0.1:{fpm_port}; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $fastcgi_script_name; + include /etc/nginx/fastcgi_params; + } + + location ~ /\. { + deny all; + } + + location /phpmyadmin/ { + root /usr/share/; + index index.php index.html index.htm; + location ~ ^/phpmyadmin/(.+\.php)$ { + root /usr/share/; + fastcgi_pass 127.0.0.1:{fpm_port}; + {ssl_comment}fastcgi_param HTTPS {fastcgi_ssl}; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $request_filename; + include /etc/nginx/fastcgi_params; + } + location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ { + root /usr/share/; + } + } +} \ No newline at end of file diff --git a/install/tpl/php_fpm_pool.conf.master b/install/tpl/php_fpm_pool.conf.master new file mode 100644 index 0000000000000000000000000000000000000000..f3a7a2fd0df79dfde48fc5560fa98a982a98d199 --- /dev/null +++ b/install/tpl/php_fpm_pool.conf.master @@ -0,0 +1,14 @@ +[{fpm_pool}] + +listen = 127.0.0.1:{fpm_port} + +user = {fpm_user} +group = {fpm_group} + +pm = dynamic +pm.max_children = 50 +pm.start_servers = 20 +pm.min_spare_servers = 5 +pm.max_spare_servers = 35 + +chdir = / \ No newline at end of file diff --git a/install/tpl/server.ini.master b/install/tpl/server.ini.master index 902ccf1126852d658491994e104ea409bf40afba..6c647a40dfda0a3a50d758feff9c1b71720876c7 100644 --- a/install/tpl/server.ini.master +++ b/install/tpl/server.ini.master @@ -35,15 +35,20 @@ message_size_limit=0 getmail_config_dir=/etc/getmail [web] +server_type=apache website_basedir=/var/www website_path=/var/www/clients/client[client_id]/web[website_id] website_symlinks=/var/www/[website_domain]/:/var/www/clients/client[client_id]/[website_domain]/ website_symlinks_rel=n vhost_conf_dir=/etc/apache2/sites-available vhost_conf_enabled_dir=/etc/apache2/sites-enabled +nginx_vhost_conf_dir=/etc/nginx/sites-available +nginx_vhost_conf_enabled_dir=/etc/nginx/sites-enabled security_level=10 user=www-data group=www-data +nginx_user=www-data +nginx_group=www-data apps_vhost_port=8081 apps_vhost_ip=_default_ apps_vhost_servername= @@ -56,6 +61,11 @@ awstats_buildstaticpages_pl=/usr/share/awstats/tools/awstats_buildstaticpages.pl php_ini_path_apache=/etc/php5/apache2/php.ini php_ini_path_cgi=/etc/php5/cgi/php.ini check_apache_config=y +nginx_cgi_socket=/var/run/fcgiwrap.socket +php_fpm_init_script=php5-fpm +php_fpm_ini_path=/etc/php5/fpm/php.ini +php_fpm_pool_dir=/etc/php5/fpm/pool.d +php_fpm_start_port=9010 [dns] bind_user=root diff --git a/install/update.php b/install/update.php index fdfba17c945cfebf1055fc5a45710571c91d3bef..f88883398f6f36e30533fc5d872845f926c27ff0 100644 --- a/install/update.php +++ b/install/update.php @@ -281,13 +281,19 @@ if($reconfigure_services_answer == 'yes') { } if($conf['services']['web']) { - //** Configure Apache - swriteln('Configuring Apache'); - $inst->configure_apache(); + if($conf['webserver']['server_type'] == 'apache'){ + //** Configure Apache + swriteln('Configuring Apache'); + $inst->configure_apache(); - //** Configure vlogger - swriteln('Configuring vlogger'); - $inst->configure_vlogger(); + //** Configure vlogger + swriteln('Configuring vlogger'); + $inst->configure_vlogger(); + } else { + //** Configure nginx + swriteln('Configuring nginx'); + $inst->configure_nginx(); + } //** Configure apps vhost swriteln('Configuring Apps vhost'); @@ -312,6 +318,7 @@ if($reconfigure_services_answer == 'yes') { } } + /* if($conf['squid']['installed'] == true) { swriteln('Configuring Squid'); $inst->configure_squid(); @@ -319,6 +326,7 @@ if($reconfigure_services_answer == 'yes') { swriteln('Configuring Nginx'); $inst->configure_nginx(); } + */ } //** Configure ISPConfig @@ -328,7 +336,12 @@ swriteln('Updating ISPConfig'); if ($conf['services']['web'] && $inst->ispconfig_interface_installed) { //** Customise the port ISPConfig runs on $ispconfig_port_number = get_ispconfig_port_number(); - $conf['apache']['vhost_port'] = $inst->free_query('ISPConfig Port', $ispconfig_port_number); + if($conf['webserver']['server_type'] == 'nginx'){ + $conf['nginx']['vhost_port'] = $inst->free_query('ISPConfig Port', $ispconfig_port_number); + } else { + $conf['apache']['vhost_port'] = $inst->free_query('ISPConfig Port', $ispconfig_port_number); + } + // $ispconfig_ssl_default = (is_ispconfig_ssl_enabled() == true)?'y':'n'; if(strtolower($inst->simple_query('Create new ISPConfig SSL certificate',array('yes','no'),'no')) == 'yes') { @@ -363,7 +376,12 @@ if($reconfigure_services_answer == 'yes') { 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'){ + 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['services']['dns']) { diff --git a/interface/web/admin/form/server_config.tform.php b/interface/web/admin/form/server_config.tform.php index 9a3691935163f3c77b8f2643193825c8c8e15e8c..dbd8521b4ac78da08fca61c6b0a0dd0c1daeb504 100644 --- a/interface/web/admin/form/server_config.tform.php +++ b/interface/web/admin/form/server_config.tform.php @@ -325,7 +325,7 @@ $form["tabs"]['web'] = array( 'datatype' => 'VARCHAR', 'formtype' => 'SELECT', 'default' => 'apache', - 'value' => array('apache' => 'Apache', 'nginx' => 'nginx') + 'value' => array('apache' => 'Apache', 'nginx' => 'Nginx') ), 'website_basedir' => array( 'datatype' => 'VARCHAR', @@ -460,6 +460,28 @@ $form["tabs"]['web'] = array( 'width' => '40', 'maxlength' => '255' ), + 'nginx_user' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array(0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'nginx_user_error_empty'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'nginx_group' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array(0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'nginx_group_error_empty'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), 'php_ini_path_apache' => array( 'datatype' => 'VARCHAR', 'formtype' => 'TEXT', @@ -482,6 +504,50 @@ $form["tabs"]['web'] = array( 'width' => '40', 'maxlength' => '255' ), + 'php_fpm_init_script' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array(0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'php_fpm_init_script_error_empty'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'php_fpm_ini_path' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array(0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'php_fpm_ini_path_error_empty'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'php_fpm_pool_dir' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array(0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'php_fpm_pool_dir_error_empty'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'php_fpm_start_port' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array(0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'php_fpm_start_port_error_empty'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), 'php_open_basedir' => array( 'datatype' => 'VARCHAR', 'formtype' => 'TEXT', @@ -493,6 +559,17 @@ $form["tabs"]['web'] = array( 'width' => '40', 'maxlength' => '4000' ), + 'nginx_cgi_socket' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array(0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'nginx_cgi_socket_empty'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), 'htaccess_allow_override' => array( 'datatype' => 'VARCHAR', 'formtype' => 'TEXT', diff --git a/interface/web/admin/lib/lang/de_server_config.lng b/interface/web/admin/lib/lang/de_server_config.lng index cf2491b9031bcb2ed97395e0015d2213e3a57d62..9ce6e27390c653682bb30fb51e7a06b771270601 100644 --- a/interface/web/admin/lib/lang/de_server_config.lng +++ b/interface/web/admin/lib/lang/de_server_config.lng @@ -70,12 +70,12 @@ $wb['awstats_conf_dir_txt'] = 'awstats conf folder'; $wb['awstats_data_dir_txt'] = 'awstats data folder'; $wb['awstats_pl_txt'] = 'awstats.pl script'; $wb['awstats_buildstaticpages_pl_txt'] = 'awstats_buildstaticpages.pl script'; -$wb['backup_dir_txt'] = 'Backup directory'; -$wb['named_conf_local_path_txt'] = 'BIND named.conf.local path'; -$wb['php_ini_path_cgi_txt'] = 'CGI php.ini path'; -$wb['php_ini_path_apache_txt'] = 'Apache php.ini path'; +$wb['backup_dir_txt'] = 'Backup-Verzeichnis'; +$wb['named_conf_local_path_txt'] = 'BIND named.conf.local Pfad'; +$wb['php_ini_path_cgi_txt'] = 'CGI php.ini Pfad'; +$wb['php_ini_path_apache_txt'] = 'Apache php.ini Pfad'; $wb['check_apache_config_txt'] = 'Test apache configuration on restart'; -$wb['CA_path_txt'] = 'CA Path'; +$wb['CA_path_txt'] = 'CA Pfad'; $wb['CA_pass_txt'] = 'CA passphrase'; $wb['ufw_enable_txt'] = 'Enable'; $wb['ufw_manage_builtins_txt'] = 'Manage Builtin Rules'; @@ -87,6 +87,56 @@ $wb['ufw_default_application_policy_txt'] = 'Default Application Policy'; $wb['ufw_log_level_txt'] = 'Log Level'; $wb['network_config_warning_txt'] = 'Die Netzwerk-Konfiguration-Option ist nur auf Debian- und Ubuntu-Servern verfügbar. Aktivieren Sie diese Option nicht, falls Ihr Netzwerk-Interface nicht eth0 heißt.'; $wb["server_type_txt"] = 'Server-Typ'; -$wb["nginx_vhost_conf_dir_txt"] = 'nginx Vhost config dir'; -$wb["nginx_vhost_conf_enabled_dir_txt"] = 'nginx Vhost config enabled dir'; +$wb["nginx_vhost_conf_dir_txt"] = 'Nginx Vhost config dir'; +$wb["nginx_vhost_conf_enabled_dir_txt"] = 'Nginx Vhost config enabled dir'; +$wb["nginx_user_txt"] = 'Nginx Benutzer'; +$wb["nginx_group_txt"] = 'Nginx Gruppe'; +$wb["nginx_cgi_socket_txt"] = 'Nginx CGI-Socket'; +$wb["backup_dir_error_empty"] = 'Backup-Verzeichnis ist leer.'; +$wb["maildir_path_error_empty"] = 'Maildir Pfad ist leer.'; +$wb["homedir_path_error_empty"] = 'Homedir Pfad ist leer.'; +$wb["mailuser_uid_error_empty"] = 'Mailuser UID ist leer.'; +$wb["mailuser_gid_error_empty"] = 'Mailuser GID ist leer.'; +$wb["mailuser_name_error_empty"] = 'Mailuser Name ist leer.'; +$wb["mailuser_group_error_empty"] = 'Mailuser Gruppe ist leer.'; +$wb["getmail_config_dir_error_empty"] = 'Getmail config dir ist leer.'; +$wb["website_basedir_error_empty"] = 'Website basedir ist leer.'; +$wb["website_path_error_empty"] = 'Website Pfad ist leer.'; +$wb["website_symlinks_error_empty"] = 'Website Symlinks ist leer.'; +$wb["vhost_conf_dir_error_empty"] = 'Vhost config dir ist leer.'; +$wb["vhost_conf_enabled_dir_error_empty"] = 'Vhost config enabled dir ist leer.'; +$wb["nginx_vhost_conf_dir_error_empty"] = 'Nginx Vhost config dir ist leer.'; +$wb["nginx_vhost_conf_enabled_dir_error_empty"] = 'Nginx Vhost config enabled dir ist leer.'; +$wb["apache_user_error_empty"] = 'Apache Benutzer ist leer.'; +$wb["apache_group_error_empty"] = 'Apache Grupp ist leer.'; +$wb["nginx_user_error_empty"] = 'Nginx Benutzer ist leer.'; +$wb["nginx_group_error_empty"] = 'Nginx Gruppe ist leer.'; +$wb["php_ini_path_apache_error_empty"] = 'Apache php.ini Pfad ist leer.'; +$wb["php_ini_path_cgi_error_empty"] = 'CGI php.ini Pfad ist leer.'; +$wb["nginx_cgi_socket_empty"] = 'Nginx CGI Socket ist leer.'; +$wb["apps_vhost_port_error_empty"] = 'Apps-vhost port ist leer.'; +$wb["apps_vhost_ip_error_empty"] = 'Apps-vhost IP ist leer.'; +$wb["fastcgi_starter_path_error_empty"] = 'FastCGI Starter Pfad ist leer.'; +$wb["fastcgi_starter_script_error_empty"] = 'FastCGI Starter Script ist leer.'; +$wb["fastcgi_alias_error_empty"] = 'FastCGI Alias ist leer.'; +$wb["fastcgi_phpini_path_error_empty"] = 'FastCGI php.ini Pfad ist leer.'; +$wb["fastcgi_children_error_empty"] = 'FastCGI Children ist leer.'; +$wb["fastcgi_max_requests_error_empty"] = 'FastCGI max. Requests ist leer.'; +$wb["fastcgi_bin_error_empty"] = 'FastCGI Bin ist leer.'; +$wb["jailkit_chroot_home_error_empty"] = 'Jailkit chroot home ist leer.'; +$wb["jailkit_chroot_app_sections_error_empty"] = 'Jailkit chroot Anwendungsbereiche ist leer.'; +$wb["jailkit_chroot_app_programs_error_empty"] = 'Jailkit chrooted Anwendungen ist leer.'; +$wb["jailkit_chroot_cron_programs_error_empty"] = 'Jailkit cron chrooted Anwendungen ist leer.'; +$wb["vlogger_config_dir_error_empty"] = 'Config Verzeichnis ist leer.'; +$wb["cron_init_script_error_empty"] = 'Cron init Script Name ist leer.'; +$wb["crontab_dir_error_empty"] = 'Pfad für individuelle Crontabs ist leer.'; +$wb["cron_wget_error_empty"] = 'Pfad zum wget Programm ist leer.'; +$wb["php_fpm_init_script_txt"] = 'PHP-FPM Init-Script'; +$wb["php_fpm_init_script_error_empty"] = 'PHP-FPM Init-Script ist leer.'; +$wb["php_fpm_ini_path_txt"] = 'PHP-FPM php.ini Pfad'; +$wb["php_fpm_ini_path_error_empty"] = 'PHP-FPM php.ini Pfad ist leer.'; +$wb["php_fpm_pool_dir_txt"] = 'PHP-FPM pool Verzeichnis'; +$wb["php_fpm_pool_dir_error_empty"] = 'PHP-FPM pool Verzeichnis ist leer.'; +$wb["php_fpm_start_port_txt"] = 'PHP-FPM Start-Port'; +$wb["php_fpm_start_port_error_empty"] = 'PHP-FPM Start-Port ist leer.'; ?> diff --git a/interface/web/admin/lib/lang/en_server_config.lng b/interface/web/admin/lib/lang/en_server_config.lng index 9b08de4772d0f8ed97a24c4c8cb3584e663612f1..d5a834a71470a28723a3b2fad0cf97e699c239f6 100644 --- a/interface/web/admin/lib/lang/en_server_config.lng +++ b/interface/web/admin/lib/lang/en_server_config.lng @@ -89,6 +89,57 @@ $wb["CA_pass_txt"] = 'CA passphrase'; $wb["fastcgi_config_syntax_txt"] = 'FastCGI config syntax'; $wb["backup_dir_ftpread_txt"] = 'Backup dir. readable for website FTP users.'; $wb["server_type_txt"] = 'Server Type'; -$wb["nginx_vhost_conf_dir_txt"] = 'nginx Vhost config dir'; -$wb["nginx_vhost_conf_enabled_dir_txt"] = 'nginx Vhost config enabled dir'; +$wb["nginx_vhost_conf_dir_txt"] = 'Nginx Vhost config dir'; +$wb["nginx_vhost_conf_enabled_dir_txt"] = 'Nginx Vhost config enabled dir'; +$wb["nginx_user_txt"] = 'Nginx user'; +$wb["nginx_group_txt"] = 'Nginx group'; +$wb["nginx_cgi_socket_txt"] = 'Nginx CGI Socket'; +$wb["backup_dir_error_empty"] = 'Backup directory is empty.'; +$wb["maildir_path_error_empty"] = 'Maildir Path is empty.'; +$wb["homedir_path_error_empty"] = 'Homedir Path is empty.'; +$wb["mailuser_uid_error_empty"] = 'Mailuser UID is empty.'; +$wb["mailuser_gid_error_empty"] = 'Mailuser GID is empty.'; +$wb["mailuser_name_error_empty"] = 'Mailuser Name is empty.'; +$wb["mailuser_group_error_empty"] = 'Mailuser Group is empty.'; +$wb["getmail_config_dir_error_empty"] = 'Getmail config dir is empty.'; +$wb["website_basedir_error_empty"] = 'Website basedir is empty.'; +$wb["website_path_error_empty"] = 'Website path is empty.'; +$wb["website_symlinks_error_empty"] = 'Website symlinks is empty.'; +$wb["vhost_conf_dir_error_empty"] = 'Vhost config dir is empty.'; +$wb["vhost_conf_enabled_dir_error_empty"] = 'Vhost config enabled dir is empty.'; +$wb["nginx_vhost_conf_dir_error_empty"] = 'Nginx Vhost config dir is empty.'; +$wb["nginx_vhost_conf_enabled_dir_error_empty"] = 'Nginx Vhost config enabled dir is empty.'; +$wb["apache_user_error_empty"] = 'Apache user is empty.'; +$wb["apache_group_error_empty"] = 'Apache group is empty.'; +$wb["nginx_user_error_empty"] = 'Nginx user is empty.'; +$wb["nginx_group_error_empty"] = 'Nginx group is empty.'; +$wb["php_ini_path_apache_error_empty"] = 'Apache php.ini path is empty.'; +$wb["php_ini_path_cgi_error_empty"] = 'CGI php.ini path is empty.'; +$wb["nginx_cgi_socket_empty"] = 'Nginx CGI Socket is empty.'; +$wb["apps_vhost_port_error_empty"] = 'Apps-vhost port is empty.'; +$wb["apps_vhost_ip_error_empty"] = 'Apps-vhost IP is empty.'; +$wb["fastcgi_starter_path_error_empty"] = 'FastCGI starter path is empty.'; +$wb["fastcgi_starter_script_error_empty"] = 'FastCGI starter script is empty.'; +$wb["fastcgi_alias_error_empty"] = 'FastCGI Alias is empty.'; +$wb["fastcgi_phpini_path_error_empty"] = 'FastCGI php.ini Path is empty.'; +$wb["fastcgi_children_error_empty"] = 'FastCGI Children is empty.'; +$wb["fastcgi_max_requests_error_empty"] = 'FastCGI max. Requests is empty.'; +$wb["fastcgi_bin_error_empty"] = 'FastCGI Bin is empty.'; +$wb["jailkit_chroot_home_error_empty"] = 'Jailkit chroot home is empty.'; +$wb["jailkit_chroot_app_sections_error_empty"] = 'Jailkit chroot app sections is empty.'; +$wb["jailkit_chroot_app_programs_error_empty"] = 'Jailkit chrooted applications is empty.'; +$wb["jailkit_chroot_cron_programs_error_empty"] = 'Jailkit cron chrooted applications is empty.'; +$wb["vlogger_config_dir_error_empty"] = 'Config directory is empty.'; +$wb["cron_init_script_error_empty"] = 'Cron init script name is empty.'; +$wb["crontab_dir_error_empty"] = 'Path for individual crontabs is empty.'; +$wb["cron_wget_error_empty"] = 'Path to wget program is empty.'; +$wb["php_fpm_init_script_txt"] = 'PHP-FPM init script'; +$wb["php_fpm_init_script_error_empty"] = 'PHP-FPM init script is empty.'; +$wb["php_fpm_ini_path_txt"] = 'PHP-FPM php.ini path'; +$wb["php_fpm_ini_path_error_empty"] = 'PHP-FPM php.ini path is empty.'; +$wb["php_fpm_pool_dir_txt"] = 'PHP-FPM pool directory'; +$wb["php_fpm_pool_dir_error_empty"] = 'PHP-FPM pool directory is empty.'; +$wb["php_fpm_start_port_txt"] = 'PHP-FPM start port'; +$wb["php_fpm_start_port_error_empty"] = 'PHP-FPM start port is empty.'; + ?> \ No newline at end of file diff --git a/interface/web/admin/templates/server_config_web_edit.htm b/interface/web/admin/templates/server_config_web_edit.htm index f22583f3f8e17a97d7c6afc8f5e0865f3fd5a865..9f60b74e39a18be4d36cbfbb2da6da97f9ec7447 100644 --- a/interface/web/admin/templates/server_config_web_edit.htm +++ b/interface/web/admin/templates/server_config_web_edit.htm @@ -31,19 +31,19 @@ {tmpl_var name='website_symlinks_rel'} -
+
-
+
-
+
-
+
@@ -55,7 +55,7 @@
-
+

{tmpl_var name='security_level_txt'}

-
+

{tmpl_var name='check_apache_config_txt'}

{tmpl_var name='check_apache_config'}
-
+
-
+
-
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ +
-
+
+ + +
+
@@ -142,29 +170,47 @@ function adjustForm(serverType){ if(serverType == "nginx"){ - jQuery('#vhost_conf_dir').closest('div.ctrlHolder').hide(); - jQuery('#vhost_conf_enabled_dir').closest('div.ctrlHolder').hide(); + jQuery('.nginx').show(); + /* jQuery('#nginx_vhost_conf_dir').closest('div.ctrlHolder').show(); jQuery('#nginx_vhost_conf_enabled_dir').closest('div.ctrlHolder').show(); + jQuery('#nginx_user').closest('div.ctrlHolder').show(); + jQuery('#nginx_group').closest('div.ctrlHolder').show(); + jQuery('#nginx_cgi_socket').closest('div.ctrlHolder').show(); + */ + jQuery('.apache').hide(); + /* + jQuery('#vhost_conf_dir').closest('div.ctrlHolder').hide(); + jQuery('#vhost_conf_enabled_dir').closest('div.ctrlHolder').hide(); jQuery('#security_level').closest('div.ctrlHolder').hide(); jQuery('#check_apache_config').closest('div.ctrlHolder').hide(); jQuery('#user').closest('div.ctrlHolder').hide(); jQuery('#group').closest('div.ctrlHolder').hide(); jQuery('#php_ini_path_apache').closest('div.ctrlHolder').hide(); jQuery('#htaccess_allow_override').closest('div.ctrlHolder').hide(); + */ } else { - jQuery('#vhost_conf_dir').closest('div.ctrlHolder').show(); - jQuery('#vhost_conf_enabled_dir').closest('div.ctrlHolder').show(); + jQuery('.nginx').hide(); + /* jQuery('#nginx_vhost_conf_dir').closest('div.ctrlHolder').hide(); jQuery('#nginx_vhost_conf_enabled_dir').closest('div.ctrlHolder').hide(); + jQuery('#nginx_user').closest('div.ctrlHolder').hide(); + jQuery('#nginx_group').closest('div.ctrlHolder').hide(); + jQuery('#nginx_cgi_socket').closest('div.ctrlHolder').hide(); + */ + jQuery('.apache').show(); + /* + jQuery('#vhost_conf_dir').closest('div.ctrlHolder').show(); + jQuery('#vhost_conf_enabled_dir').closest('div.ctrlHolder').show(); jQuery('#security_level').closest('div.ctrlHolder').show(); jQuery('#check_apache_config').closest('div.ctrlHolder').show(); jQuery('#user').closest('div.ctrlHolder').show(); jQuery('#group').closest('div.ctrlHolder').show(); jQuery('#php_ini_path_apache').closest('div.ctrlHolder').show(); jQuery('#htaccess_allow_override').closest('div.ctrlHolder').show(); + */ } } \ No newline at end of file diff --git a/interface/web/js/scrigo.js.php b/interface/web/js/scrigo.js.php index 4e9012e03d226f6a68ab809680877b3134a8183c..cda82acb69ee3423a84c530079356e5a5ed26dd1 100644 --- a/interface/web/js/scrigo.js.php +++ b/interface/web/js/scrigo.js.php @@ -16,25 +16,13 @@ function reportError(request) { } function loadContentRefresh(pagename) { - /* - var pageContentCallbackRefresh = { - success: function(o) { - document.getElementById('pageContent').innerHTML = o.responseText; - }, - failure: function(o) { - reportError('Ajax Request was not successful.'+pagename); - } - } - */ if(document.getElementById('refreshinterval').value > 0) { - /*var pageContentObject2 = YAHOO.util.Connect.asyncRequest('GET', pagename+"&refresh="+document.getElementById('refreshinterval').value, pageContentCallbackRefresh);*/ var pageContentObject2 = jQuery.ajax({ type: "GET", url: pagename, data: "refresh="+document.getElementById('refreshinterval').value, dataType: "html", success: function(data, textStatus, jqXHR) { - //document.getElementById('pageContent').innerHTML = jqXHR.responseText; jQuery('#pageContent').html(jqXHR.responseText); }, error: function() { @@ -46,25 +34,6 @@ function loadContentRefresh(pagename) { } function capp(module) { - /* - var cappCallback = { - success: function(o) { - if(o.responseText != '') { - if(o.responseText.indexOf('HEADER_REDIRECT:') > -1) { - var parts = o.responseText.split(':'); - loadContent(parts[1]); - } else { - alert(o.responseText); - } - } - loadMenus(); - }, - failure: function(o) { - reportError('Ajax Request was not successful.'+module); - } - } - */ - /*var submitFormObj = YAHOO.util.Connect.asyncRequest('GET', 'capp.php?mod='+module, cappCallback);*/ var submitFormObj = jQuery.ajax({ type: "GET", url: "capp.php", data: "mod="+module, @@ -87,8 +56,6 @@ function capp(module) { } function submitLoginForm(formname) { - - //* Validate form. TODO: username and password with strip(); var frm = document.getElementById(formname); var userNameObj = frm.username; @@ -101,8 +68,6 @@ function submitLoginForm(formname) { passwordObj.focus(); return; } - /*YAHOO.util.Connect.setForm(formname);*/ - /*var submitFormObj = YAHOO.util.Connect.asyncRequest('POST', 'content.php', submitFormCallback);*/ var submitFormObj = jQuery.ajax({ type: "POST", url: "content.php", data: jQuery('#'+formname).serialize(), @@ -118,7 +83,6 @@ function submitLoginForm(formname) { // Go to the login page document.location.href = 'index.php'; } else { - //document.getElementById('pageContent').innerHTML = jqXHR.responseText; jQuery('#pageContent').html(jqXHR.responseText); } loadMenus(); @@ -137,29 +101,7 @@ function submitLoginForm(formname) { } -function submitForm(formname,target) { - /* - var submitFormCallback = { - success: function(o) { - if(o.responseText.indexOf('HEADER_REDIRECT:') > -1) { - var parts = o.responseText.split(':'); - //alert(parts[1]); - loadContent(parts[1]); - //redirect = parts[1]; - //window.setTimeout('loadContent(redirect)', 1000); - } else { - document.getElementById('pageContent').innerHTML = o.responseText; - } - }, - failure: function(o) { - var parts = o.responseText.split(':'); - reportError('Ajax Request was not successful. 111'); - } - } - */ - - /*YAHOO.util.Connect.setForm(formname);*/ - /*var submitFormObj = YAHOO.util.Connect.asyncRequest('POST', target, submitFormCallback);*/ +function submitForm(formname,target) { var submitFormObj = jQuery.ajax({ type: "POST", url: target, data: jQuery('#'+formname).serialize(), @@ -172,7 +114,6 @@ function submitForm(formname,target) { //redirect = parts[1]; //window.setTimeout('loadContent(redirect)', 1000); } else { - //document.getElementById('pageContent').innerHTML = jqXHR.responseText; jQuery('#pageContent').html(jqXHR.responseText); } }, @@ -189,63 +130,7 @@ function submitForm(formname,target) { */ } -function submitUploadForm(formname,target) { - /* - var submitFormCallback = { - success: function(o) { - if(o.responseText.indexOf('HEADER_REDIRECT:') > -1) { - var parts = o.responseText.split(':'); - //alert(parts[1]); - loadContent(parts[1]); - //redirect = parts[1]; - //window.setTimeout('loadContent(redirect)', 1000); - } else { - document.getElementById('pageContent').innerHTML = o.responseText; - } - }, - upload: function(o) { - if(o.responseText.indexOf('HEADER_REDIRECT:') > -1) { - var parts = o.responseText.split(':'); - //alert(parts[1]); - loadContent(parts[1]); - //redirect = parts[1]; - //window.setTimeout('loadContent(redirect)', 1000); - } else { - document.getElementById('pageContent').innerHTML = o.responseText; - } - }, - failure: function(o) { - reportError('Ajax Request was not successful. 112'); - } - } - */ - - /*YAHOO.util.Connect.setForm(formname,true);*/ - /*var submitFormObj = YAHOO.util.Connect.asyncRequest('POST', target, submitFormCallback);*/ - /* - var submitFormObj = jQuery.ajax({ type: "POST", - url: target, - data: jQuery('#'+formname).serialize(), - dataType: "html", - success: function(data, textStatus, jqXHR) { - if(jqXHR.responseText.indexOf('HEADER_REDIRECT:') > -1) { - var parts = jqXHR.responseText.split(':'); - //alert(parts[1]); - loadContent(parts[1]); - //redirect = parts[1]; - //window.setTimeout('loadContent(redirect)', 1000); - } else { - //document.getElementById('pageContent').innerHTML = jqXHR.responseText; - jQuery('#pageContent').html(jqXHR.responseText); - } - }, - error: function() { - reportError('Ajax Request was not successful. 112'); - }, - }); - */ - //var submitFormObj = jQuery('input[type="file"]').ajaxfileupload({ 'action': target }); - +function submitUploadForm(formname,target) { var handleResponse = function(loadedFrame) { var response, responseStr = loadedFrame.contentWindow.document.body.innerHTML; @@ -288,25 +173,6 @@ function submitUploadForm(formname,target) { } function loadContent(pagename) { - /* - var pageContentCallback2 = { - success: function(o) { - if(o.responseText.indexOf('HEADER_REDIRECT:') > -1) { - var parts = o.responseText.split(':'); - loadContent(parts[1]); - } else if (o.responseText.indexOf('URL_REDIRECT:') > -1) { - var newUrl= o.responseText.substr(o.responseText.indexOf('URL_REDIRECT:') + "URL_REDIRECT:".length); - document.location.href = newUrl; - } else { - document.getElementById('pageContent').innerHTML = o.responseText; - } - }, - failure: function(o) { - reportError('Ajax Request was not successful. 113'); - } - } - */ - /*var pageContentObject2 = YAHOO.util.Connect.asyncRequest('GET', pagename, pageContentCallback2);*/ var pageContentObject2 = jQuery.ajax({ type: "GET", url: pagename, dataType: "html", @@ -334,22 +200,6 @@ function loadContent(pagename) { function loadInitContent() { - /* - var pageContentCallback = { - success: function(o) { - if(o.responseText.indexOf('HEADER_REDIRECT:') > -1) { - var parts = o.responseText.split(":"); - loadContent(parts[1]); - } else { - document.getElementById('pageContent').innerHTML = o.responseText; - } - }, - failure: function(o) { - reportError('Ajax Request was not successful. 114'); - } - } - */ - /*var pageContentObject = YAHOO.util.Connect.asyncRequest('GET', 'content.php?s_mod=login&s_pg=index', pageContentCallback);*/ var pageContentObject = jQuery.ajax({ type: "GET", url: "content.php", data: "s_mod=login&s_pg=index", @@ -359,7 +209,6 @@ function loadInitContent() { var parts = jqXHR.responseText.split(":"); loadContent(parts[1]); } else { - //document.getElementById('pageContent').innerHTML = jqXHR.responseText; jQuery('#pageContent').html(jqXHR.responseText); } }, @@ -375,24 +224,6 @@ function loadInitContent() { } function setFocus() { -/* - var flag=false; - for(z=0;z{tmpl_var name='system_group'}
-
+
@@ -28,11 +28,11 @@
-
+
-
+
@@ -51,7 +51,7 @@ var webId = jQuery('input[name="id"]').val(); var serverId; getServerId(webId); - serverType(serverId); + adjustForm(serverId); function getServerId(webId){ jQuery.getJSON('sites/ajax_get_json.php'+ '?' + Math.round(new Date().getTime()), {web_id : webId, type : "getserverid"}, function(data) { @@ -59,14 +59,22 @@ }); } - function serverType(serverId){ + function adjustForm(serverId){ jQuery.getJSON('sites/ajax_get_json.php'+ '?' + Math.round(new Date().getTime()), {server_id : serverId, type : "getservertype"}, function(data) { if(data.servertype == "nginx"){ + jQuery('.nginx').show(); + jQuery('.apache').hide(); + /* jQuery('#allow_override').closest('div.ctrlHolder').hide(); jQuery('#apache_directives').closest('div.ctrlHolder').hide(); + */ } else { + jQuery('.nginx').hide(); + jQuery('.apache').show(); + /* jQuery('#allow_override').closest('div.ctrlHolder').show(); jQuery('#apache_directives').closest('div.ctrlHolder').show(); + */ } }); } diff --git a/interface/web/sites/templates/web_domain_edit.htm b/interface/web/sites/templates/web_domain_edit.htm index b748afe14334a7fb5fc26685a72ec6c05aba7b48..9e2a6b5d0eb8cdadf6517734cf883dc6356248d1 100644 --- a/interface/web/sites/templates/web_domain_edit.htm +++ b/interface/web/sites/templates/web_domain_edit.htm @@ -71,13 +71,13 @@ {tmpl_var name='ssi'}
-
+

{tmpl_var name='ruby_txt'}

{tmpl_var name='ruby'}
-
+

{tmpl_var name='suexec_txt'}

{tmpl_var name='suexec'} @@ -134,24 +134,24 @@ serverId = jQuery('#server_id').val(); jQuery('#server_id').change(function(){ serverId = $(this).val(); - serverType(serverId); + adjustForm(serverId); }); } - serverType(serverId); + adjustForm(serverId); - function serverType(serverId){ + function adjustForm(serverId){ jQuery.getJSON('sites/ajax_get_json.php'+ '?' + Math.round(new Date().getTime()), {server_id : serverId, type : "getservertype"}, function(data) { if(data.servertype == "nginx"){ var selected = jQuery('#php').val(); - jQuery('#ruby').closest('div.ctrlHolder').hide(); - jQuery('#suexec').closest('div.ctrlHolder').hide(); + jQuery('.apache').hide(); + jQuery('.apache').hide(); jQuery('#php option[value="cgi"]').hide(); jQuery('#php option[value="mod"]').hide(); jQuery('#php option[value="suphp"]').hide(); if(selected != "no" && selected != "fast-cgi") jQuery('#php option[value="fast-cgi"]').attr('selected', 'selected'); } else { - jQuery('#ruby').closest('div.ctrlHolder').show(); - jQuery('#suexec').closest('div.ctrlHolder').show(); + jQuery('.apache').show(); + jQuery('.apache').show(); jQuery('#php option[value="cgi"]').show(); jQuery('#php option[value="mod"]').show(); jQuery('#php option[value="suphp"]').show(); diff --git a/server/conf/nginx_apps.vhost.master b/server/conf/nginx_apps.vhost.master new file mode 100644 index 0000000000000000000000000000000000000000..30416e3e3a479e4f2a1c632c62e39a1a7e100bd2 --- /dev/null +++ b/server/conf/nginx_apps.vhost.master @@ -0,0 +1,28 @@ +server { + listen {apps_vhost_ip}{apps_vhost_port}; + + server_name {apps_vhost_servername}; + + root {apps_vhost_dir}; + + location / { + index index.php index.html; + } + + # serve static files directly + location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt)$ { + access_log off; + } + + location ~ \.php$ { + fastcgi_pass 127.0.0.1:{fpm_port}; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $fastcgi_script_name; + include /etc/nginx/fastcgi_params; + } + + location ~ /\. { + deny all; + } +} \ No newline at end of file diff --git a/server/conf/nginx_vhost.conf.master b/server/conf/nginx_vhost.conf.master index 7bbf187e0d7c8c1af550228a475929feb982d89d..9da8c2bb26fd851c354bd37d282d26be5cfca6d3 100644 --- a/server/conf/nginx_vhost.conf.master +++ b/server/conf/nginx_vhost.conf.master @@ -67,7 +67,7 @@ server { location ~ \.php$ { - fastcgi_pass 127.0.0.1:9000; + fastcgi_pass 127.0.0.1:; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_script_name; diff --git a/server/conf/php_fpm_pool.conf.master b/server/conf/php_fpm_pool.conf.master new file mode 100644 index 0000000000000000000000000000000000000000..600d484f72d285e6a4a14953d0cc336693776604 --- /dev/null +++ b/server/conf/php_fpm_pool.conf.master @@ -0,0 +1,14 @@ +[] + +listen = 127.0.0.1: + +user = +group = + +pm = dynamic +pm.max_children = 50 +pm.start_servers = 20 +pm.min_spare_servers = 5 +pm.max_spare_servers = 35 + +chdir = / \ No newline at end of file diff --git a/server/mods-available/web_module.inc.php b/server/mods-available/web_module.inc.php index 643c7a17c33a94e96ef8908e5748f4e412a33b35..4fdae18ef66aa4a1c2eca85693116c92cd466cf8 100644 --- a/server/mods-available/web_module.inc.php +++ b/server/mods-available/web_module.inc.php @@ -137,6 +137,9 @@ class web_module { switch ($web_config['server_type']) { case 'nginx': $daemon = $web_config['server_type']; + // Reload PHP-FPM as well + $restart_second_service['daemon'] = $web_config['php_fpm_init_script']; + $restart_second_service['action'] = 'reload'; break; default: if(is_file($conf['init_scripts'] . '/' . 'httpd')) { @@ -146,6 +149,10 @@ class web_module { } } + if($restart_second_service['daemon'] != '' && $restart_second_service['action'] != ''){ + exec($conf['init_scripts'] . '/' . $restart_second_service['daemon'] . ' ' . $restart_second_service['action']); + } + if($action == 'restart') { exec($conf['init_scripts'] . '/' . $daemon . ' restart'); } else { diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php index a499ae43860f028c148e26b223f4da1ed3fd8046..5a702b32c2389b8eed0c85b1b8ec6f3a35b81dcd 100644 --- a/server/plugins-available/apache2_plugin.inc.php +++ b/server/plugins-available/apache2_plugin.inc.php @@ -444,42 +444,42 @@ class apache2_plugin { // Copy the error pages if($data['new']['errordocs']) { $error_page_path = escapeshellcmd($data['new']['document_root']).'/web/error/'; - if (file_exists($conf['templates'] . '-custom/error/'.substr(escapeshellcmd($conf['language']),0,2))) { - exec('cp ' . $conf['templates'] . '-custom/error/'.substr(escapeshellcmd($conf['language']),0,2).'/* '.$error_page_path); + if (file_exists($conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']),0,2))) { + exec('cp ' . $conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']),0,2).'/* '.$error_page_path); } else { - if (file_exists($conf['templates'] . '-custom/error/400.html')) { - exec('cp '. $conf['templates'] .'-custom/error/*.html '.$error_page_path); + if (file_exists($conf['rootpath'] . '/conf-custom/error/400.html')) { + exec('cp '. $conf['rootpath'] . '/conf-custom/error/*.html '.$error_page_path); } else { - exec('cp ' . $conf['templates'] . '/error/'.substr(escapeshellcmd($conf['language']),0,2).'/* '.$error_page_path); + exec('cp ' . $conf['rootpath'] . '/conf/error/'.substr(escapeshellcmd($conf['language']),0,2).'/* '.$error_page_path); } } exec('chmod -R a+r '.$error_page_path); } - if (file_exists($conf['templates'] . '-custom/index/standard_index.html_'.substr(escapeshellcmd($conf['language']),0,2))) { - exec('cp ' . $conf['templates'] . '-custom/index/standard_index.html_'.substr(escapeshellcmd($conf['language']),0,2).' '.escapeshellcmd($data['new']['document_root']).'/web/index.html'); + if (file_exists($conf['rootpath'] . '/conf-custom/index/standard_index.html_'.substr(escapeshellcmd($conf['language']),0,2))) { + exec('cp ' . $conf['rootpath'] . '/conf-custom/index/standard_index.html_'.substr(escapeshellcmd($conf['language']),0,2).' '.escapeshellcmd($data['new']['document_root']).'/web/index.html'); - if(is_file($conf['templates'] . '-custom/index/favicon.ico')) { - exec('cp ' . $conf['templates'] . '-custom/index/favicon.ico '.escapeshellcmd($data['new']['document_root']).'/web/'); + if(is_file($conf['rootpath'] . '/conf-custom/index/favicon.ico')) { + exec('cp ' . $conf['rootpath'] . '/conf-custom/index/favicon.ico '.escapeshellcmd($data['new']['document_root']).'/web/'); } - if(is_file($conf['templates'] . '-custom/index/robots.txt')) { - exec('cp ' . $conf['templates'] . '-custom/index/robots.txt '.escapeshellcmd($data['new']['document_root']).'/web/'); + if(is_file($conf['rootpath'] . '/conf-custom/index/robots.txt')) { + exec('cp ' . $conf['rootpath'] . '/conf-custom/index/robots.txt '.escapeshellcmd($data['new']['document_root']).'/web/'); } - if(is_file($conf['templates'] . '-custom/index/.htaccess')) { - exec('cp ' . $conf['templates'] . '-custom/index/.htaccess '.escapeshellcmd($data['new']['document_root']).'/web/'); + if(is_file($conf['rootpath'] . '/conf-custom/index/.htaccess')) { + exec('cp ' . $conf['rootpath'] . '/conf-custom/index/.htaccess '.escapeshellcmd($data['new']['document_root']).'/web/'); } } else { - if (file_exists($conf['templates'] . '-custom/index/standard_index.html')) { - exec('cp ' . $conf['templates'] . '-custom/index/standard_index.html '.escapeshellcmd($data['new']['document_root']).'/web/index.html'); + if (file_exists($conf['rootpath'] . '/conf-custom/index/standard_index.html')) { + exec('cp ' . $conf['rootpath'] . '/conf-custom/index/standard_index.html '.escapeshellcmd($data['new']['document_root']).'/web/index.html'); } else { - exec('cp ' . $conf['templates'] . '/index/standard_index.html_'.substr(escapeshellcmd($conf['language']),0,2).' '.escapeshellcmd($data['new']['document_root']).'/web/index.html'); - if(is_file($conf['templates'] . '/index/favicon.ico')) exec('cp ' . $conf['templates'] . '/index/favicon.ico '.escapeshellcmd($data['new']['document_root']).'/web/'); - if(is_file($conf['templates'] . '/index/robots.txt')) exec('cp ' . $conf['templates'] . '/index/robots.txt '.escapeshellcmd($data['new']['document_root']).'/web/'); - if(is_file($conf['templates'] . '/index/.htaccess')) exec('cp ' . $conf['templates'] . '/index/.htaccess '.escapeshellcmd($data['new']['document_root']).'/web/'); + exec('cp ' . $conf['rootpath'] . '/conf/index/standard_index.html_'.substr(escapeshellcmd($conf['language']),0,2).' '.escapeshellcmd($data['new']['document_root']).'/web/index.html'); + if(is_file($conf['rootpath'] . '/conf/index/favicon.ico')) exec('cp ' . $conf['rootpath'] . '/conf/index/favicon.ico '.escapeshellcmd($data['new']['document_root']).'/web/'); + if(is_file($conf['rootpath'] . '/conf/index/robots.txt')) exec('cp ' . $conf['rootpath'] . '/conf/index/robots.txt '.escapeshellcmd($data['new']['document_root']).'/web/'); + if(is_file($conf['rootpath'] . '/conf/index/.htaccess')) exec('cp ' . $conf['rootpath'] . '/conf/index/.htaccess '.escapeshellcmd($data['new']['document_root']).'/web/'); } } exec('chmod -R a+r '.escapeshellcmd($data['new']['document_root']).'/web/'); @@ -488,15 +488,15 @@ class apache2_plugin { } elseif ($this->action == 'update' && $data['new']['type'] == 'vhost' && $data['old']['errordocs'] == 0 && $data['new']['errordocs'] == 1) { $error_page_path = escapeshellcmd($data['new']['document_root']).'/web/error/'; - if (file_exists($conf['templates'] . '-custom/error/'.substr(escapeshellcmd($conf['language']),0,2))) { - exec('cp ' . $conf['templates'] . '-custom/error/'.substr(escapeshellcmd($conf['language']),0,2).'/* '.$error_page_path); + if (file_exists($conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']),0,2))) { + exec('cp ' . $conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']),0,2).'/* '.$error_page_path); } else { - if (file_exists($conf['templates'] . '-custom/error/400.html')) { - exec('cp ' . $conf['templates'] . '-custom/error/*.html '.$error_page_path); + if (file_exists($conf['rootpath'] . '/conf-custom/error/400.html')) { + exec('cp ' . $conf['rootpath'] . '/conf-custom/error/*.html '.$error_page_path); } else { - exec('cp ' . $conf['templates'] . '/error/'.substr(escapeshellcmd($conf['language']),0,2).'/* '.$error_page_path); + exec('cp ' . $conf['rootpath'] . '/conf/error/'.substr(escapeshellcmd($conf['language']),0,2).'/* '.$error_page_path); } } exec('chmod -R a+r '.$error_page_path); diff --git a/server/plugins-available/apps_vhost_plugin.inc.php b/server/plugins-available/apps_vhost_plugin.inc.php index 47107b00dd3faf352cc4077a0adc5c7cbf744830..47202a8fcba334afb0935348b6a769af45b13ce3 100644 --- a/server/plugins-available/apps_vhost_plugin.inc.php +++ b/server/plugins-available/apps_vhost_plugin.inc.php @@ -75,35 +75,58 @@ class apps_vhost_plugin { $app->uses("getconf"); $web_config = $app->getconf->get_server_config($conf["server_id"], 'web'); - // Dont just copy over the virtualhost template but add some custom settings - $content = file_get_contents($conf["rootpath"]."/conf/apache_apps.vhost.master"); - - $vhost_conf_dir = $web_config['vhost_conf_dir']; - $vhost_conf_enabled_dir = $web_config['vhost_conf_enabled_dir']; - $apps_vhost_servername = ($web_config['apps_vhost_servername'] == '')?'':'ServerName '.$web_config['apps_vhost_servername']; - - $web_config['apps_vhost_port'] = (empty($web_config['apps_vhost_port']))?8081:$web_config['apps_vhost_port']; - $web_config['apps_vhost_ip'] = (empty($web_config['apps_vhost_ip']))?'_default_':$web_config['apps_vhost_ip']; - - $content = str_replace('{apps_vhost_ip}', $web_config['apps_vhost_ip'], $content); - $content = str_replace('{apps_vhost_port}', $web_config['apps_vhost_port'], $content); - $content = str_replace('{apps_vhost_dir}', $web_config['website_basedir'].'/apps', $content); - $content = str_replace('{apps_vhost_servername}', $apps_vhost_servername, $content); - $content = str_replace('{apps_vhost_basedir}', $web_config['website_basedir'], $content); - + if($web_config['server_type'] == 'apache'){ + // Dont just copy over the virtualhost template but add some custom settings + $content = file_get_contents($conf["rootpath"]."/conf/apache_apps.vhost.master"); + + $vhost_conf_dir = $web_config['vhost_conf_dir']; + $vhost_conf_enabled_dir = $web_config['vhost_conf_enabled_dir']; + $apps_vhost_servername = ($web_config['apps_vhost_servername'] == '')?'':'ServerName '.$web_config['apps_vhost_servername']; + + $web_config['apps_vhost_port'] = (empty($web_config['apps_vhost_port']))?8081:$web_config['apps_vhost_port']; + $web_config['apps_vhost_ip'] = (empty($web_config['apps_vhost_ip']))?'_default_':$web_config['apps_vhost_ip']; + + $content = str_replace('{apps_vhost_ip}', $web_config['apps_vhost_ip'], $content); + $content = str_replace('{apps_vhost_port}', $web_config['apps_vhost_port'], $content); + $content = str_replace('{apps_vhost_dir}', $web_config['website_basedir'].'/apps', $content); + $content = str_replace('{apps_vhost_servername}', $apps_vhost_servername, $content); + $content = str_replace('{apps_vhost_basedir}', $web_config['website_basedir'], $content); + + + // comment out the listen directive if port is 80 or 443 + if($web_config['apps_vhost_ip'] == 80 or $web_config['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($web_config['apps_vhost_ip'] == 80 or $web_config['apps_vhost_ip'] == 443) { - $content = str_replace('{vhost_port_listen}', '#', $content); - } else { - $content = str_replace('{vhost_port_listen}', '', $content); + if($web_config['server_type'] == 'nginx'){ + // Dont just copy over the virtualhost template but add some custom settings + $content = file_get_contents($conf["rootpath"]."/conf/nginx_apps.vhost.master"); + + $vhost_conf_dir = $web_config['nginx_vhost_conf_dir']; + $vhost_conf_enabled_dir = $web_config['nginx_vhost_conf_enabled_dir']; + $apps_vhost_servername = ($web_config['apps_vhost_servername'] == '')?'_':$web_config['apps_vhost_servername']; + + $web_config['apps_vhost_port'] = (empty($web_config['apps_vhost_port']))?8081:$web_config['apps_vhost_port']; + $web_config['apps_vhost_ip'] = (empty($web_config['apps_vhost_ip']))?'_default_':$web_config['apps_vhost_ip']; + + if($web_config['apps_vhost_ip'] == '_default_'){ + $apps_vhost_ip = ''; + } else { + $apps_vhost_ip = $web_config['apps_vhost_ip'].':'; + } + + $content = str_replace('{apps_vhost_ip}', $apps_vhost_ip, $content); + $content = str_replace('{apps_vhost_port}', $web_config['apps_vhost_port'], $content); + $content = str_replace('{apps_vhost_dir}', $web_config['website_basedir'].'/apps', $content); + $content = str_replace('{apps_vhost_servername}', $apps_vhost_servername, $content); + $content = str_replace('{fpm_port}', $web_config['php_fpm_start_port'], $content); } file_put_contents("$vhost_conf_dir/apps.vhost", $content); - $app->services->restartServiceDelayed('httpd','restart'); - - } diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php index cd2b351a10a226e97335fd6dc09f31e4007510ad..8ff7258d40cc3cce6d8b1e4991f7a6c49efd1380 100644 --- a/server/plugins-available/nginx_plugin.inc.php +++ b/server/plugins-available/nginx_plugin.inc.php @@ -435,42 +435,42 @@ class nginx_plugin { // Copy the error pages if($data['new']['errordocs']) { $error_page_path = escapeshellcmd($data['new']['document_root']).'/web/error/'; - if (file_exists($conf['templates'] . '-custom/error/'.substr(escapeshellcmd($conf['language']),0,2))) { - exec('cp ' . $conf['templates'] . '-custom/error/'.substr(escapeshellcmd($conf['language']),0,2).'/* '.$error_page_path); + if (file_exists($conf['rootpath'].'/conf-custom/error/'.substr(escapeshellcmd($conf['language']),0,2))) { + exec('cp ' . $conf['rootpath'].'/conf-custom/error/'.substr(escapeshellcmd($conf['language']),0,2).'/* '.$error_page_path); } else { - if (file_exists($conf['templates'] . '-custom/error/400.html')) { - exec('cp '. $conf['templates'] .'-custom/error/*.html '.$error_page_path); + if (file_exists($conf['rootpath'].'/conf-custom/error/400.html')) { + exec('cp '. $conf['rootpath'].'/conf-custom/error/*.html '.$error_page_path); } else { - exec('cp ' . $conf['templates'] . '/error/'.substr(escapeshellcmd($conf['language']),0,2).'/* '.$error_page_path); + exec('cp ' . $conf['rootpath'] . '/conf/error/'.substr(escapeshellcmd($conf['language']),0,2).'/* '.$error_page_path); } } exec('chmod -R a+r '.$error_page_path); } - if (file_exists($conf['templates'] . '-custom/index/standard_index.html_'.substr(escapeshellcmd($conf['language']),0,2))) { - exec('cp ' . $conf['templates'] . '-custom/index/standard_index.html_'.substr(escapeshellcmd($conf['language']),0,2).' '.escapeshellcmd($data['new']['document_root']).'/web/index.html'); + if (file_exists($conf['rootpath'] . '/conf-custom/index/standard_index.html_'.substr(escapeshellcmd($conf['language']),0,2))) { + exec('cp ' . $conf['rootpath'] . '/conf-custom/index/standard_index.html_'.substr(escapeshellcmd($conf['language']),0,2).' '.escapeshellcmd($data['new']['document_root']).'/web/index.html'); - if(is_file($conf['templates'] . '-custom/index/favicon.ico')) { - exec('cp ' . $conf['templates'] . '-custom/index/favicon.ico '.escapeshellcmd($data['new']['document_root']).'/web/'); + if(is_file($conf['rootpath'] . '/conf-custom/index/favicon.ico')) { + exec('cp ' . $conf['rootpath'] . '/conf-custom/index/favicon.ico '.escapeshellcmd($data['new']['document_root']).'/web/'); } - if(is_file($conf['templates'] . '-custom/index/robots.txt')) { - exec('cp ' . $conf['templates'] . '-custom/index/robots.txt '.escapeshellcmd($data['new']['document_root']).'/web/'); + if(is_file($conf['rootpath'] . '/conf-custom/index/robots.txt')) { + exec('cp ' . $conf['rootpath'] . '/conf-custom/index/robots.txt '.escapeshellcmd($data['new']['document_root']).'/web/'); } - if(is_file($conf['templates'] . '-custom/index/.htaccess')) { - exec('cp ' . $conf['templates'] . '-custom/index/.htaccess '.escapeshellcmd($data['new']['document_root']).'/web/'); + if(is_file($conf['rootpath'] . '/conf-custom/index/.htaccess')) { + exec('cp ' . $conf['rootpath'] . '/conf-custom/index/.htaccess '.escapeshellcmd($data['new']['document_root']).'/web/'); } } else { - if (file_exists($conf['templates'] . '-custom/index/standard_index.html')) { - exec('cp ' . $conf['templates'] . '-custom/index/standard_index.html '.escapeshellcmd($data['new']['document_root']).'/web/index.html'); + if (file_exists($conf['rootpath'] . '/conf-custom/index/standard_index.html')) { + exec('cp ' . $conf['rootpath'] . '/conf-custom/index/standard_index.html '.escapeshellcmd($data['new']['document_root']).'/web/index.html'); } else { - exec('cp ' . $conf['templates'] . '/index/standard_index.html_'.substr(escapeshellcmd($conf['language']),0,2).' '.escapeshellcmd($data['new']['document_root']).'/web/index.html'); - if(is_file($conf['templates'] . '/index/favicon.ico')) exec('cp ' . $conf['templates'] . '/index/favicon.ico '.escapeshellcmd($data['new']['document_root']).'/web/'); - if(is_file($conf['templates'] . '/index/robots.txt')) exec('cp ' . $conf['templates'] . '/index/robots.txt '.escapeshellcmd($data['new']['document_root']).'/web/'); - if(is_file($conf['templates'] . '/index/.htaccess')) exec('cp ' . $conf['templates'] . '/index/.htaccess '.escapeshellcmd($data['new']['document_root']).'/web/'); + exec('cp ' . $conf['rootpath'] . '/conf/index/standard_index.html_'.substr(escapeshellcmd($conf['language']),0,2).' '.escapeshellcmd($data['new']['document_root']).'/web/index.html'); + if(is_file($conf['rootpath'] . '/conf/index/favicon.ico')) exec('cp ' . $conf['rootpath'] . '/conf/index/favicon.ico '.escapeshellcmd($data['new']['document_root']).'/web/'); + if(is_file($conf['rootpath'] . '/conf/index/robots.txt')) exec('cp ' . $conf['rootpath'] . '/conf/index/robots.txt '.escapeshellcmd($data['new']['document_root']).'/web/'); + if(is_file($conf['rootpath'] . '/conf/index/.htaccess')) exec('cp ' . $conf['rootpath'] . '/conf/index/.htaccess '.escapeshellcmd($data['new']['document_root']).'/web/'); } } exec('chmod -R a+r '.escapeshellcmd($data['new']['document_root']).'/web/'); @@ -479,15 +479,15 @@ class nginx_plugin { } elseif ($this->action == 'update' && $data['new']['type'] == 'vhost' && $data['old']['errordocs'] == 0 && $data['new']['errordocs'] == 1) { $error_page_path = escapeshellcmd($data['new']['document_root']).'/web/error/'; - if (file_exists($conf['templates'] . '-custom/error/'.substr(escapeshellcmd($conf['language']),0,2))) { - exec('cp ' . $conf['templates'] . '-custom/error/'.substr(escapeshellcmd($conf['language']),0,2).'/* '.$error_page_path); + if (file_exists($conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']),0,2))) { + exec('cp ' . $conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']),0,2).'/* '.$error_page_path); } else { - if (file_exists($conf['templates'] . '-custom/error/400.html')) { - exec('cp ' . $conf['templates'] . '-custom/error/*.html '.$error_page_path); + if (file_exists($conf['rootpath'] . '/conf-custom/error/400.html')) { + exec('cp ' . $conf['rootpath'] . '/conf-custom/error/*.html '.$error_page_path); } else { - exec('cp ' . $conf['templates'] . '/error/'.substr(escapeshellcmd($conf['language']),0,2).'/* '.$error_page_path); + exec('cp ' . $conf['rootpath'] . '/conf/error/'.substr(escapeshellcmd($conf['language']),0,2).'/* '.$error_page_path); } } exec('chmod -R a+r '.$error_page_path); @@ -644,6 +644,7 @@ class nginx_plugin { $vhost_data['ssl_domain'] = $data['new']['ssl_domain']; //$vhost_data['has_custom_php_ini'] = $has_custom_php_ini; //$vhost_data['custom_php_ini_dir'] = escapeshellcmd($custom_php_ini_dir); + $vhost_data['fpm_port'] = $web_config['php_fpm_start_port'] + $data['new']['domain_id']; // Check if a SSL cert exists $ssl_dir = $data['new']['document_root'].'/ssl'; @@ -843,6 +844,8 @@ class nginx_plugin { $this->awstats_update($data,$web_config); } + $this->php_fpm_pool_update($data,$web_config); + if($web_config['check_apache_config'] == 'y') { //* Test if nginx starts with the new configuration file $nginx_online_status_before_restart = $this->_checkTcp('localhost',80); @@ -976,6 +979,10 @@ class nginx_plugin { if($data['old']['stats_type'] == 'awstats') { $this->awstats_delete($data,$web_config); } + + if($data['old']['php'] == 'fast-cgi') { + $this->php_fpm_pool_delete($data,$web_config); + } } } @@ -1039,6 +1046,64 @@ class nginx_plugin { } } + //* Update the PHP-FPM pool configuration file + private function php_fpm_pool_update ($data,$web_config) { + global $app, $conf; + + $pool_dir = $web_config['php_fpm_pool_dir']; + //$reload = false; + + if($data['new']['php'] == 'no'){ + if(@is_file($pool_dir.'/'.$data['old']['domain'].'.conf')){ + unlink($pool_dir.'/'.$data['old']['domain'].'.conf'); + //$reload = true; + } + if(@is_file($pool_dir.'/'.$data['new']['domain'].'.conf')){ + unlink($pool_dir.'/'.$data['new']['domain'].'.conf'); + //$reload = true; + } + //if($reload == true) $app->services->restartService('php-fpm','reload'); + return; + } + + if(!@is_file($pool_dir.'/'.$data['new']['domain'].'.conf') || ($data['old']['domain'] != '' && $data['new']['domain'] != $data['old']['domain'])) { + if ( @is_file($pool_dir.'/'.$data['old']['domain'].'.conf') ) { + unlink($pool_dir.'/'.$data['old']['domain'].'.conf'); + } + + $app->uses("getconf"); + $web_config = $app->getconf->get_server_config($conf["server_id"], 'web'); + + $app->load('tpl'); + $tpl = new tpl(); + $tpl->newTemplate('php_fpm_pool.conf.master'); + + $tpl->setVar('fpm_pool', $data['new']['domain']); + $tpl->setVar('fpm_port', $web_config['php_fpm_start_port'] + $data['new']['domain_id']); + $tpl->setVar('fpm_user', $data['new']['system_user']); + $tpl->setVar('fpm_group', $data['new']['system_group']); + + file_put_contents($pool_dir.'/'.$data['new']['domain'].'.conf',$tpl->grab()); + $app->log('Writing the PHP-FPM config file: '.$pool_dir.'/'.$data['new']['domain'].'.conf',LOGLEVEL_DEBUG); + unset($tpl); + //$reload = true; + } + //if($reload == true) $app->services->restartService('php-fpm','reload'); + } + + //* Delete the PHP-FPM pool configuration file + private function php_fpm_pool_delete ($data,$web_config) { + global $app; + + $pool_dir = $web_config['php_fpm_pool_dir']; + + if ( @is_file($pool_dir.'/'.$data['old']['domain'].'.conf') ) { + unlink($pool_dir.'/'.$data['old']['domain'].'.conf'); + $app->log('Removed PHP-FPM config file: '.$pool_dir.'/'.$data['old']['domain'].'.conf',LOGLEVEL_DEBUG); + $app->services->restartService('php-fpm','reload'); + } + } + function client_delete($event_name,$data) { global $app, $conf; diff --git a/server/plugins-available/nginx_reverseproxy_plugin.inc.php b/server/plugins-available/nginx_reverseproxy_plugin.inc.php index e725d7b85c048cd619a963ee8927fe20161a4a97..96f2b9b8daf96b2a3c745079ce75aee5b4befd41 100644 --- a/server/plugins-available/nginx_reverseproxy_plugin.inc.php +++ b/server/plugins-available/nginx_reverseproxy_plugin.inc.php @@ -89,7 +89,7 @@ class nginx_reverseproxy_plugin { // load the server configuration options $app->uses('getconf'); - $nginx_config = $app->getconf->get_server_config($conf['server_id'], 'nginx'); + $nginx_config = $app->getconf->get_server_config($conf['server_id'], 'web'); // Create group and user, if not exist $app->uses('system'); @@ -176,7 +176,7 @@ class nginx_reverseproxy_plugin { } - $vhost_file = escapeshellcmd($nginx_config['vhost_conf_dir'].'/'.$data['new']['domain'].'.vhost'); + $vhost_file = escapeshellcmd($nginx_config['nginx_vhost_conf_dir'].'/'.$data['new']['domain'].'.vhost'); //* Make a backup copy of vhost file copy($vhost_file,$vhost_file.'~'); @@ -187,7 +187,7 @@ class nginx_reverseproxy_plugin { // Set the symlink to enable the vhost - $vhost_symlink = escapeshellcmd($nginx_config['vhost_conf_enabled_dir'].'/'.$data['new']['domain'].'.vhost'); + $vhost_symlink = escapeshellcmd($nginx_config['nginx_vhost_conf_enabled_dir'].'/'.$data['new']['domain'].'.vhost'); if($data['new']['active'] == 'y' && !is_link($vhost_symlink)) { symlink($vhost_file,$vhost_symlink); $app->log('Creating symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG); @@ -203,10 +203,10 @@ class nginx_reverseproxy_plugin { // remove old symlink and vhost file, if domain name of the site has changed if($this->action == 'update' && $data['old']['domain'] != '' && $data['new']['domain'] != $data['old']['domain']) { - $vhost_symlink = escapeshellcmd($nginx_config['vhost_conf_enabled_dir'].'/'.$data['old']['domain'].'.vhost'); + $vhost_symlink = escapeshellcmd($nginx_config['nginx_vhost_conf_enabled_dir'].'/'.$data['old']['domain'].'.vhost'); unlink($vhost_symlink); $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG); - $vhost_file = escapeshellcmd($nginx_config['vhost_conf_dir'].'/'.$data['old']['domain'].'.vhost'); + $vhost_file = escapeshellcmd($nginx_config['nginx_vhost_conf_dir'].'/'.$data['old']['domain'].'.vhost'); unlink($vhost_file); $app->log('Removing file: '.$vhost_file,LOGLEVEL_DEBUG); @@ -277,18 +277,18 @@ class nginx_reverseproxy_plugin { // load the server configuration options $app->uses('getconf'); - $nginx_config = $app->getconf->get_server_config($conf['server_id'], 'nginx'); + $nginx_config = $app->getconf->get_server_config($conf['server_id'], 'web'); if($data['old']['type'] == 'vhost') { //* This is a website // Deleting the vhost file, symlink and the data directory - $vhost_symlink = escapeshellcmd($nginx_config['vhost_conf_enabled_dir'].'/'.$data['old']['domain'].'.vhost'); + $vhost_symlink = escapeshellcmd($nginx_config['nginx_vhost_conf_enabled_dir'].'/'.$data['old']['domain'].'.vhost'); unlink($vhost_symlink); $app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG); - $vhost_file = escapeshellcmd($nginx_config['vhost_conf_dir'].'/'.$data['old']['domain'].'.vhost'); + $vhost_file = escapeshellcmd($nginx_config['nginx_vhost_conf_dir'].'/'.$data['old']['domain'].'.vhost'); unlink($vhost_file); $app->log('Removing vhost file: '.$vhost_file,LOGLEVEL_DEBUG); @@ -322,14 +322,14 @@ class nginx_reverseproxy_plugin { $rules = $this->_getRewriteRules($app); $app->uses('getconf'); - $nginx_config = $app->getconf->get_server_config($conf['server_id'], 'nginx'); + $nginx_config = $app->getconf->get_server_config($conf['server_id'], 'web'); $app->load('tpl'); $tpl = new tpl(); $tpl->newTemplate("nginx_reverseproxy_rewrites.conf.master"); if (!empty($rules))$tpl->setLoop('nginx_rewrite_rules',$rules); - $rewrites_file = escapeshellcmd($nginx_config['vhost_conf_dir'].'/default.rewrites.conf'); + $rewrites_file = escapeshellcmd($nginx_config['nginx_vhost_conf_dir'].'/default.rewrites.conf'); //* Make a backup copy of vhost file copy($rewrites_file,$rewrites_file.'~'); @@ -340,7 +340,7 @@ class nginx_reverseproxy_plugin { // Set the symlink to enable the vhost - $rewrite_symlink = escapeshellcmd($nginx_config['vhost_conf_enabled_dir'].'/default.rewrites.conf'); + $rewrite_symlink = escapeshellcmd($nginx_config['nginx_vhost_conf_enabled_dir'].'/default.rewrites.conf'); if(!is_link($rewrite_symlink)) { symlink($rewrites_file,$rewrite_symlink);