ftimme
2011-09-19 4ffb51e51f89a45256836fb55ad1c29f5e06beb2
- Added nginx support to the installer.
5 files added
28 files modified
1570 ■■■■■ changed files
install/autoupdate.php 28 ●●●●● patch | view | raw | blame | history
install/dist/conf/centos52.conf.php 15 ●●●●● patch | view | raw | blame | history
install/dist/conf/centos53.conf.php 15 ●●●●● patch | view | raw | blame | history
install/dist/conf/debian40.conf.php 8 ●●●●● patch | view | raw | blame | history
install/dist/conf/debian60.conf.php 8 ●●●●● patch | view | raw | blame | history
install/dist/conf/fedora9.conf.php 15 ●●●●● patch | view | raw | blame | history
install/dist/conf/gentoo.conf.php 15 ●●●●● patch | view | raw | blame | history
install/dist/conf/opensuse110.conf.php 15 ●●●●● patch | view | raw | blame | history
install/dist/conf/opensuse112.conf.php 15 ●●●●● patch | view | raw | blame | history
install/install.php 101 ●●●● patch | view | raw | blame | history
install/lib/install.lib.php 12 ●●●● patch | view | raw | blame | history
install/lib/installer_base.lib.php 291 ●●●● patch | view | raw | blame | history
install/lib/update.lib.php 28 ●●●●● patch | view | raw | blame | history
install/tpl/nginx_apps.vhost.master 28 ●●●●● patch | view | raw | blame | history
install/tpl/nginx_ispconfig.vhost.master 46 ●●●●● patch | view | raw | blame | history
install/tpl/php_fpm_pool.conf.master 14 ●●●●● patch | view | raw | blame | history
install/tpl/server.ini.master 10 ●●●●● patch | view | raw | blame | history
install/update.php 34 ●●●● patch | view | raw | blame | history
interface/web/admin/form/server_config.tform.php 79 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/de_server_config.lng 64 ●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/en_server_config.lng 55 ●●●●● patch | view | raw | blame | history
interface/web/admin/templates/server_config_web_edit.htm 74 ●●●● patch | view | raw | blame | history
interface/web/js/scrigo.js.php 267 ●●●●● patch | view | raw | blame | history
interface/web/sites/templates/web_domain_advanced.htm 18 ●●●● patch | view | raw | blame | history
interface/web/sites/templates/web_domain_edit.htm 18 ●●●● patch | view | raw | blame | history
server/conf/nginx_apps.vhost.master 28 ●●●●● patch | view | raw | blame | history
server/conf/nginx_vhost.conf.master 2 ●●● patch | view | raw | blame | history
server/conf/php_fpm_pool.conf.master 14 ●●●●● patch | view | raw | blame | history
server/mods-available/web_module.inc.php 7 ●●●●● patch | view | raw | blame | history
server/plugins-available/apache2_plugin.inc.php 48 ●●●● patch | view | raw | blame | history
server/plugins-available/apps_vhost_plugin.inc.php 63 ●●●●● patch | view | raw | blame | history
server/plugins-available/nginx_plugin.inc.php 113 ●●●● patch | view | raw | blame | history
server/plugins-available/nginx_reverseproxy_plugin.inc.php 22 ●●●● patch | view | raw | blame | history
install/autoupdate.php
@@ -249,15 +249,21 @@
    }
}
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['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']) {
install/dist/conf/centos52.conf.php
@@ -178,6 +178,21 @@
$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';
install/dist/conf/centos53.conf.php
@@ -178,6 +178,21 @@
$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';
install/dist/conf/debian40.conf.php
@@ -192,10 +192,18 @@
//* 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;
install/dist/conf/debian60.conf.php
@@ -192,10 +192,18 @@
//* 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;
install/dist/conf/fedora9.conf.php
@@ -178,6 +178,21 @@
$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';
install/dist/conf/gentoo.conf.php
@@ -194,6 +194,21 @@
$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';
install/dist/conf/opensuse110.conf.php
@@ -178,6 +178,21 @@
$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';
install/dist/conf/opensuse112.conf.php
@@ -178,6 +178,21 @@
$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';
install/install.php
@@ -157,6 +157,16 @@
    //* 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 @@
    }
    
    //* 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 @@
        $inst->configure_fail2ban();
    }
    
    /*
    if($conf['squid']['installed'] == true) {
        $conf['services']['proxy'] = true;
        swriteln('Configuring Squid');
@@ -257,6 +276,7 @@
        swriteln('Configuring Nginx');
        $inst->configure_nginx();
    }
    */
    
    //* Configure ISPConfig
    swriteln('Installing ISPConfig');
@@ -291,7 +311,12 @@
    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 @@
    
    //* 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 @@
        
    }
    
    /*
    //** 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($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 @@
        */
        //** 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 @@
    //* 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');
    }
    
    
    
install/lib/install.lib.php
@@ -633,11 +633,17 @@
function get_ispconfig_port_number() {
    global $conf;
    $ispconfig_vhost_file = $conf['apache']['vhost_conf_dir'].'/ispconfig.vhost';
    if($conf['nginx']['installed'] == true){
        $ispconfig_vhost_file = $conf['nginx']['vhost_conf_dir'].'/ispconfig.vhost';
        $regex = '/listen (\d+)/';
    } else {
        $ispconfig_vhost_file = $conf['apache']['vhost_conf_dir'].'/ispconfig.vhost';
        $regex = '/\<VirtualHost.*\:(\d{1,})\>/';
    }
    if(is_file($ispconfig_vhost_file)) {
        $tmp = file_get_contents($ispconfig_vhost_file);
        preg_match('/\<VirtualHost.*\:(\d{1,})\>/',$tmp,$matches);
        preg_match($regex,$tmp,$matches);
        $port_number = intval($matches[1]);
        if($port_number > 0) {
            return $port_number;
install/lib/installer_base.lib.php
@@ -234,8 +234,17 @@
        $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 @@
    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 @@
    }
    
    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 @@
        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 @@
        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');
            //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(!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 @@
        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 @@
        $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');
            //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(!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
install/lib/update.lib.php
@@ -126,6 +126,18 @@
    
    $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 @@
    
    //* 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 @@
    $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)) {
install/tpl/nginx_apps.vhost.master
New file
@@ -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;
        }
}
install/tpl/nginx_ispconfig.vhost.master
New file
@@ -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/;
               }
        }
}
install/tpl/php_fpm_pool.conf.master
New file
@@ -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 = /
install/tpl/server.ini.master
@@ -35,15 +35,20 @@
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 @@
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
install/update.php
@@ -281,13 +281,19 @@
    }
    
    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($conf['squid']['installed'] == true) {
        swriteln('Configuring Squid');
        $inst->configure_squid();
@@ -319,6 +326,7 @@
        swriteln('Configuring Nginx');
        $inst->configure_nginx();
    }
    */
}
//** Configure ISPConfig
@@ -328,7 +336,12 @@
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($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']) {
interface/web/admin/form/server_config.tform.php
@@ -325,7 +325,7 @@
            '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 @@
            '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 @@
            '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 @@
            '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',
interface/web/admin/lib/lang/de_server_config.lng
@@ -70,12 +70,12 @@
$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_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.';
?>
interface/web/admin/lib/lang/en_server_config.lng
@@ -89,6 +89,57 @@
$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.';
?>
interface/web/admin/templates/server_config_web_edit.htm
@@ -31,19 +31,19 @@
                {tmpl_var name='website_symlinks_rel'}
            </div>
      </div>
      <div class="ctrlHolder">
      <div class="ctrlHolder apache">
          <label for="vhost_conf_dir">{tmpl_var name='vhost_conf_dir_txt'}</label>
        <input name="vhost_conf_dir" id="vhost_conf_dir" value="{tmpl_var name='vhost_conf_dir'}" size="40" maxlength="255" type="text" class="textInput" />
            </div>
      <div class="ctrlHolder">
      <div class="ctrlHolder apache">
          <label for="vhost_conf_enabled_dir">{tmpl_var name='vhost_conf_enabled_dir_txt'}</label>
        <input name="vhost_conf_enabled_dir" id="vhost_conf_enabled_dir" value="{tmpl_var name='vhost_conf_enabled_dir'}" size="40" maxlength="255" type="text" class="textInput" />
            </div>
    <div class="ctrlHolder">
    <div class="ctrlHolder nginx">
          <label for="nginx_vhost_conf_dir">{tmpl_var name='nginx_vhost_conf_dir_txt'}</label>
        <input name="nginx_vhost_conf_dir" id="nginx_vhost_conf_dir" value="{tmpl_var name='nginx_vhost_conf_dir'}" size="40" maxlength="255" type="text" class="textInput" />
            </div>
      <div class="ctrlHolder">
      <div class="ctrlHolder nginx">
          <label for="nginx_vhost_conf_enabled_dir">{tmpl_var name='nginx_vhost_conf_enabled_dir_txt'}</label>
        <input name="nginx_vhost_conf_enabled_dir" id="nginx_vhost_conf_enabled_dir" value="{tmpl_var name='nginx_vhost_conf_enabled_dir'}" size="40" maxlength="255" type="text" class="textInput" />
            </div>
@@ -55,7 +55,7 @@
          <label for="CA_pass">{tmpl_var name='CA_pass_txt'}</label>
        <input name="CA_pass" id="CA_pass" value="{tmpl_var name='CA_pass'}" size="40" maxlength="255" type="password" class="textInput" />
            </div>
      <div class="ctrlHolder">
      <div class="ctrlHolder apache">
                <p class="label">{tmpl_var name='security_level_txt'}</p>
                    <div class="multiField">
                        <select name="security_level" id="security_level" class="selectInput">
@@ -63,21 +63,29 @@
                </select>
                    </div>
            </div>
      <div class="ctrlHolder">
      <div class="ctrlHolder apache">
                <p class="label">{tmpl_var name='check_apache_config_txt'}</p>
                    <div class="multiField">
                        {tmpl_var name='check_apache_config'}
                    </div>
            </div>
      <div class="ctrlHolder">
      <div class="ctrlHolder apache">
          <label for="user">{tmpl_var name='web_user_txt'}</label>
        <input name="user" id="user" value="{tmpl_var name='user'}" size="40" maxlength="255" type="text" class="textInput" />
            </div>
      <div class="ctrlHolder">
      <div class="ctrlHolder apache">
          <label for="group">{tmpl_var name='web_group_txt'}</label>
        <input name="group" id="group" value="{tmpl_var name='group'}" size="40" maxlength="255" type="text" class="textInput" />
      </div>
      <div class="ctrlHolder">
      <div class="ctrlHolder nginx">
          <label for="nginx_user">{tmpl_var name='nginx_user_txt'}</label>
        <input name="nginx_user" id="nginx_user" value="{tmpl_var name='nginx_user'}" size="40" maxlength="255" type="text" class="textInput" />
            </div>
      <div class="ctrlHolder nginx">
          <label for="nginx_group">{tmpl_var name='nginx_group_txt'}</label>
        <input name="nginx_group" id="nginx_group" value="{tmpl_var name='nginx_group'}" size="40" maxlength="255" type="text" class="textInput" />
      </div>
      <div class="ctrlHolder apache">
          <label for="php_ini_path_apache">{tmpl_var name='php_ini_path_apache_txt'}</label>
        <input name="php_ini_path_apache" id="php_ini_path_apache" value="{tmpl_var name='php_ini_path_apache'}" size="40" maxlength="255" type="text" class="textInput" />
      </div>
@@ -85,11 +93,31 @@
          <label for="php_ini_path_cgi">{tmpl_var name='php_ini_path_cgi_txt'}</label>
        <input name="php_ini_path_cgi" id="php_ini_path_cgi" value="{tmpl_var name='php_ini_path_cgi'}" size="40" maxlength="255" type="text" class="textInput" />
      </div>
      <div class="ctrlHolder nginx">
          <label for="php_fpm_init_script">{tmpl_var name='php_fpm_init_script_txt'}</label>
        <input name="php_fpm_init_script" id="php_fpm_init_script" value="{tmpl_var name='php_fpm_init_script'}" size="40" maxlength="255" type="text" class="textInput" />
      </div>
      <div class="ctrlHolder nginx">
          <label for="php_fpm_ini_path">{tmpl_var name='php_fpm_ini_path_txt'}</label>
        <input name="php_fpm_ini_path" id="php_fpm_ini_path" value="{tmpl_var name='php_fpm_ini_path'}" size="40" maxlength="255" type="text" class="textInput" />
      </div>
      <div class="ctrlHolder nginx">
          <label for="php_fpm_pool_dir">{tmpl_var name='php_fpm_pool_dir_txt'}</label>
        <input name="php_fpm_pool_dir" id="php_fpm_pool_dir" value="{tmpl_var name='php_fpm_pool_dir'}" size="40" maxlength="255" type="text" class="textInput" />
      </div>
      <div class="ctrlHolder nginx">
          <label for="php_fpm_start_port">{tmpl_var name='php_fpm_start_port_txt'}</label>
        <input name="php_fpm_start_port" id="php_fpm_start_port" value="{tmpl_var name='php_fpm_start_port'}" size="40" maxlength="255" type="text" class="textInput" />
      </div>
      <div class="ctrlHolder">
          <label for="php_open_basedir">{tmpl_var name='php_open_basedir_txt'}</label>
        <input name="php_open_basedir" id="php_open_basedir" value="{tmpl_var name='php_open_basedir'}" size="40" type="text" class="textInput" />
      </div>
      <div class="ctrlHolder">
      <div class="ctrlHolder nginx">
          <label for="nginx_cgi_socket">{tmpl_var name='nginx_cgi_socket_txt'}</label>
        <input name="nginx_cgi_socket" id="nginx_cgi_socket" value="{tmpl_var name='nginx_cgi_socket'}" size="40" maxlength="255" type="text" class="textInput" />
      </div>
      <div class="ctrlHolder apache">
          <label for="htaccess_allow_override">{tmpl_var name='htaccess_allow_override_txt'}</label>
        <input name="htaccess_allow_override" id="htaccess_allow_override" value="{tmpl_var name='htaccess_allow_override'}" size="40" maxlength="255" type="text" class="textInput" />
      </div>
@@ -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();
                */
            }
        }
</script>
interface/web/js/scrigo.js.php
@@ -16,25 +16,13 @@
}
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 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 submitLoginForm(formname) {
    //* Validate form. TODO: username and password with strip();
    var frm = document.getElementById(formname);
    var userNameObj = frm.username;
@@ -101,8 +68,6 @@
        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 @@
                                                    // 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 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 @@
                                                    //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 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 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 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 @@
                                                    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 setFocus() {
/*
    var flag=false;
        for(z=0;z<document.forms.length;z++) {
            var form = document.forms[z];
            var elements = form.elements;
            for (var i=0;i<elements.length;i++) {
                var element = elements[i];
                if(element.type == 'text' &&
                    !element.readOnly &&
                    !element.disabled) {
                        element.focus();
                        flag=true;
                        break;
                    }
            }
            if(flag)break;
        }
*/
    try {
        document.pageForm.username.focus();
    } catch (e) {
@@ -401,24 +232,11 @@
function loadMenus() {
    /*
    var sideNavCallback = {
        success: function(o) {
            document.getElementById('sideNav').innerHTML = o.responseText;
        },
        failure: function(o) {
            reportError('Ajax Request was not successful. 115');
        }
    }
    */
  /*var sideNavObject = YAHOO.util.Connect.asyncRequest('GET', 'nav.php?nav=side', sideNavCallback);*/
  var sideNavObject = jQuery.ajax({            type: "GET", 
                                            url: "nav.php",
                                            data: "nav=side",
                                            dataType: "html",
                                            success: function(data, textStatus, jqXHR) {
                                                //document.getElementById('sideNav').innerHTML = jqXHR.responseText;
                                                jQuery('#sideNav').html(jqXHR.responseText);
                                            },
                                            error: function() {
@@ -426,24 +244,11 @@
                                            },
                                    });
    
    /*
    var topNavCallback = {
        success: function(o) {
            document.getElementById('topNav').innerHTML = o.responseText;
        },
        failure: function(o) {
            reportError('Ajax Request was not successful. 116');
        }
    }
    */
  /*var topNavObject = YAHOO.util.Connect.asyncRequest('GET', 'nav.php?nav=top', topNavCallback);*/
  var topNavObject = jQuery.ajax({            type: "GET", 
                                            url: "nav.php",
                                            data: "nav=top",
                                            dataType: "html",
                                            success: function(data, textStatus, jqXHR) {
                                                //document.getElementById('topNav').innerHTML = jqXHR.responseText;
                                                jQuery('#topNav').html(jqXHR.responseText);
                                            },
                                            error: function(o) {
@@ -466,24 +271,10 @@
}
function loadContentInto(elementid,pagename) {
    /*
    var itemContentCallback = {
        success: function(o) {
            document.getElementById(elementid).innerHTML = o.responseText;
        },
        failure: function(o) {
            reportError('Ajax Request was not successful. 118');
        }
    }
    */
  /*var pageContentObject2 = YAHOO.util.Connect.asyncRequest('GET', pagename, itemContentCallback);*/
  var pageContentObject2 = jQuery.ajax({    type: "GET", 
                                            url: pagename,
                                            dataType: "html",
                                            success: function(data, textStatus, jqXHR) {
                                                //document.getElementById(elementid).innerHTML = jqXHR.responseText;
                                                jQuery('#'+elementid).html(jqXHR.responseText);
                                            },
                                            error: function() {
@@ -493,27 +284,6 @@
}
function loadOptionInto(elementid,pagename) {
    /*
    var itemContentCallback = {
        success: function(o) {
            var teste = o.responseText;
            var elemente = teste.split('#');
            el=document.getElementById(elementid);
            el.innerHTML='';
            for (var i = 0; i < elemente.length; ++i){
                var foo2 = document.createElement("option");
                foo2.appendChild(document.createTextNode(elemente[i]));
                foo2.value=elemente[i];
                el.appendChild(foo2);
            }
        },
        failure: function(o) {
        reportError('Ajax Request was not successful. 119');
        }
    }
    */
    /*var pageContentObject2 = YAHOO.util.Connect.asyncRequest('GET', pagename, itemContentCallback);*/
    var pageContentObject2 = jQuery.ajax({    type: "GET", 
                                            url: pagename,
                                            dataType: "html",
@@ -537,18 +307,6 @@
}
function keepalive() {
    /*
    var pageContentCallbackKeepalive = {
        success: function(o) {
            setTimeout( keepalive, 1000000 );
        },
        failure: function(o) {
            reportError('Session expired. Please login again.');
        }
    }
    */
      /*var pageContentObject3 = YAHOO.util.Connect.asyncRequest('GET', 'keepalive.php', pageContentCallbackKeepalive);*/
    var pageContentObject3 = jQuery.ajax({    type: "GET", 
                                            url: "keepalive.php",
                                            dataType: "html",
@@ -736,27 +494,6 @@
}
function loadwebip(elementid,pagename) {
    /*
    var itemContentCallback = {
        success: function(o) {
            var teste = o.responseText;
            var elemente = teste.split('#');
            el=document.getElementById(elementid);
            el.innerHTML='';
            for (var i = 0; i < elemente.length; ++i){
                var foo2 = document.createElement("option");
                foo2.appendChild(document.createTextNode(elemente[i]));
                foo2.value=elemente[i];
                el.appendChild(foo2);
            }
        },
        failure: function(o) {
        reportError('Ajax Request was not successful. 119');
        }
    }
    */
    /*var pageContentObject2 = YAHOO.util.Connect.asyncRequest('GET', pagename, itemContentCallback);*/
    var pageContentObject2 = jQuery.ajax({    type: "GET", 
                                            url: pagename,
                                            dataType: "html",
interface/web/sites/templates/web_domain_advanced.htm
@@ -16,7 +16,7 @@
        <label for="system_group">{tmpl_var name='system_group'}</label>
        <input name="system_group" id="system_group" value="{tmpl_var name='system_group'}" type="hidden" />
            </div>
      <div class="ctrlHolder">
      <div class="ctrlHolder apache">
          <label for="allow_override">{tmpl_var name='allow_override_txt'}</label>
        <input name="allow_override" id="allow_override" value="{tmpl_var name='allow_override'}" size="30" maxlength="255" type="text" class="textInput" />
      </div>
@@ -28,11 +28,11 @@
          <label for="custom_php_ini">{tmpl_var name='custom_php_ini_txt'}</label>
          <textarea name="custom_php_ini" id="custom_php_ini" rows='10' cols='50' style="width:400px;">{tmpl_var name='custom_php_ini'}</textarea>
      </div>
      <div class="ctrlHolder">
      <div class="ctrlHolder apache">
          <label for="apache_directives">{tmpl_var name='apache_directives_txt'}</label>
          <textarea name="apache_directives" id="apache_directives" rows='10' cols='50' style="width:400px;">{tmpl_var name='apache_directives'}</textarea>
      </div>
      <div class="ctrlHolder">
      <div class="ctrlHolder nginx">
          <label for="nginx_directives">{tmpl_var name='nginx_directives_txt'}</label>
          <textarea name="nginx_directives" id="nginx_directives" rows='10' cols='50' style="width:400px;">{tmpl_var name='nginx_directives'}</textarea>
      </div>
@@ -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();
                    */
                }
            });
        }
interface/web/sites/templates/web_domain_edit.htm
@@ -71,13 +71,13 @@
                        {tmpl_var name='ssi'}
                    </div>
      </div>
      <div class="ctrlHolder">
      <div class="ctrlHolder apache">
                <p class="label">{tmpl_var name='ruby_txt'}</p>
                    <div class="multiField">
                        {tmpl_var name='ruby'}
                    </div>
      </div>
      <div class="ctrlHolder">
      <div class="ctrlHolder apache">
                <p class="label">{tmpl_var name='suexec_txt'}</p>
                    <div class="multiField">
                        {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();
server/conf/nginx_apps.vhost.master
New file
@@ -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;
        }
}
server/conf/nginx_vhost.conf.master
@@ -67,7 +67,7 @@
        <tmpl_if name='php' op='==' value='fast-cgi'>
        
        location ~ \.php$ {
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_pass 127.0.0.1:<tmpl_var name='fpm_port'>;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_param PATH_INFO $fastcgi_script_name;
server/conf/php_fpm_pool.conf.master
New file
@@ -0,0 +1,14 @@
[<tmpl_var name='fpm_pool'>]
listen = 127.0.0.1:<tmpl_var name='fpm_port'>
user = <tmpl_var name='fpm_user'>
group = <tmpl_var name='fpm_group'>
pm = dynamic
pm.max_children = 50
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
chdir = /
server/mods-available/web_module.inc.php
@@ -137,6 +137,9 @@
        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 @@
                }
        }
        
        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 {
server/plugins-available/apache2_plugin.inc.php
@@ -444,42 +444,42 @@
            // 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 @@
        } 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);
server/plugins-available/apps_vhost_plugin.inc.php
@@ -75,35 +75,58 @@
        $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");
        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'];
            $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'];
            $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);
            $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');
    }
    
server/plugins-available/nginx_plugin.inc.php
@@ -435,42 +435,42 @@
            // 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 @@
        } 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 @@
        $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 @@
            $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 @@
            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 @@
        }
    }
    
    //* 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;
        
server/plugins-available/nginx_reverseproxy_plugin.inc.php
@@ -89,7 +89,7 @@
        
        // 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 @@
        }
        
        $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 @@
        // 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 @@
        // 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 @@
        // 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 @@
        $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 @@
        // 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);