daniel
2008-06-04 9b9ba428a25ff39cca0f92c97ffa24659392a2f9

8 files modified
107 ■■■■■ changed files
install/install.php 17 ●●●●● patch | view | raw | blame | history
install/lib/installer_base.lib.php 12 ●●●●● patch | view | raw | blame | history
install/tpl/apache_ispconfig.vhost.master 7 ●●●●● patch | view | raw | blame | history
install/tpl/server.ini.master 9 ●●●● patch | view | raw | blame | history
install/update.php 18 ●●●●● patch | view | raw | blame | history
interface/web/sites/web_domain_edit.php 1 ●●●● patch | view | raw | blame | history
server/conf/vhost.conf.master 6 ●●●●● patch | view | raw | blame | history
server/plugins-available/apache2_plugin.inc.php 37 ●●●●● patch | view | raw | blame | history
install/install.php
@@ -174,6 +174,23 @@
    //* Configure ISPConfig
    swriteln('Installing ISPConfig');
    //** We want to check if the server is a module or cgi based php enabled server
    //** TODO: Don't always ask for this somehow ?
    $fast_cgi = $inst->simple_query('CGI PHP Enabled Server?', array('yes','no'),'no');
    if($fast_cgi == 'yes') {
         $alias = $inst->free_query('Script Alias', '/php/');
         $path = $inst->free_query('Script Alias Path', '/path/to/cgi/bin');
         $inst->conf['apache']['vhost_cgi_alias'] = sprintf('ScriptAlias %s %s', $alias, $path);
    } else {
         $inst->conf['apache']['vhost_cgi_alias'] = "";
    }
    //** Customise the port ISPConfig runs on
    $inst->conf['apache']['vhost_port'] = $inst->free_query('ISPConfig Port', '8080');
    $inst->install_ispconfig();
    //* Configure ISPConfig
install/lib/installer_base.lib.php
@@ -691,7 +691,17 @@
        // TODO: These are missing! should they be "vhost_dist_*_dir" ?
        $vhost_conf_dir = $this->conf['apache']['vhost_conf_dir'];
        $vhost_conf_enabled_dir = $this->conf['apache']['vhost_conf_enabled_dir'];
        copy('tpl/apache_ispconfig.vhost.master', "$vhost_conf_dir/ispconfig.vhost");
        // Dont just copy over the virtualhost template but add some custom settings
        $content = rf("tpl/apache_ispconfig.vhost.master");
        $content = str_replace('{vhost_port}', $this->conf['apache']['vhost_port'], $content);
        $content = str_replace('{vhost_cgi_alias}', $this->conf['apache']['vhost_cgi_alias'], $content);
        wf("$vhost_conf_dir/ispconfig.vhost", $content);
        //copy('tpl/apache_ispconfig.vhost.master', "$vhost_conf_dir/ispconfig.vhost");
        //* and create the symlink
        if(!is_link("$vhost_conf_enabled_dir/ispconfig.vhost")) {
            exec("ln -s $vhost_conf_dir/ispconfig.vhost $vhost_conf_enabled_dir/ispconfig.vhost");
install/tpl/apache_ispconfig.vhost.master
@@ -4,13 +4,14 @@
# for the ISPConfig controlpanel
######################################################
Listen 8080
NameVirtualHost *:8080
Listen {vhost_port}
NameVirtualHost *:{vhost_port}
<VirtualHost _default_:8080>
<VirtualHost _default_:{vhost_port}>
    ServerAdmin webmaster@localhost
    DocumentRoot /usr/local/ispconfig/interface/web/
    
    {vhost_cgi_alias}
    <IfModule mod_php5.c>
          AddType application/x-httpd-php .php
    </IfModule>
install/tpl/server.ini.master
@@ -31,4 +31,11 @@
website_path=/var/clients/client[client_id]/web[website_id]
website_symlinks=/var/www/[website_domain]/:/var/clients/client[client_id]/[website_domain]/
vhost_conf_dir=/etc/apache2/sites-available
vhost_conf_enabled_dir=/etc/apache2/sites-enabled
vhost_conf_enabled_dir=/etc/apache2/sites-enabled
fastcgi_starter_path=/var/www/php-fcgi-scripts/[system_user]/
fastcgi_starter_script=.php-fcgi-starter
fastcgi_alias=/php/
fastcgi_phpini_path=/etc/php5/cgi/
fastcgi_children=8
fastcgi_max_requests=5000
fastcgi_bin=/usr/bin/php-cgi
install/update.php
@@ -174,6 +174,24 @@
//** Configure ISPConfig
swriteln('Updating ISPConfig');
//** We want to check if the server is a module or cgi based php enabled server
//** TODO: Don't always ask for this somehow ?
$fast_cgi = $inst->simple_query('CGI PHP Enabled Server?', array('yes','no'),'no');
if($fast_cgi == 'yes') {
     $alias = $inst->free_query('Script Alias', '/php/');
     $path = $inst->free_query('Script Alias Path', '/path/to/cgi/bin');
     $inst->conf['apache']['vhost_cgi_alias'] = sprintf('ScriptAlias %s %s', $alias, $path);
} else {
     $inst->conf['apache']['vhost_cgi_alias'] = "";
}
//** Customise the port ISPConfig runs on
$inst->conf['apache']['vhost_port'] = $inst->free_query('ISPConfig Port', '8080');
$inst->install_ispconfig();
//** Configure Crontab
interface/web/sites/web_domain_edit.php
@@ -154,7 +154,6 @@
            }
            $app->tpl->setVar("client_group_id",$client_select);
            
        }
        
        parent::onShowEnd();
server/conf/vhost.conf.master
@@ -46,6 +46,12 @@
    # php as cgi enabled
    AddType application/x-httpd-php .php .php3 .php4 .php5
</tmpl_if>
<tmpl_if name='php' op='==' value='fast-cgi'>
    # php as fast-cgi enabled
    AddType application/x-httpd-php .php .php3 .php4 .php5
    ScriptAlias <tmpl_var name='fastcgi_alias'> <tmpl_var name='fastcgi_starter_path'>
</tmpl_if>
<tmpl_if name="rewrite_enabled">
    RewriteEngine on
server/plugins-available/apache2_plugin.inc.php
@@ -374,6 +374,43 @@
        }
        $tpl->setLoop('redirects',$rewrite_rules);
        
        /**
         * install fast-cgi starter script and add script aliasd config
         * first we create the script directory if not already created, then copy over the starter script
         * settings are copied over from the server ini config for now
         * TODO: Create form for fastcgi configs per site.
         */
        if ($data["new"]["php"] == "fast-cgi")
        {
            $fastcgi_starter_path = str_replace("[system_user]",$data["new"]["system_user"],$web_config["fastcgi_starter_path"]);
            if (!is_dir($fastcgi_starter_path))
            {
                exec("mkdir $fastcgi_starter_path");
                exec("chown ".$data["new"]["system_user"].":".$data["new"]["system_group"]." $fastcgi_starter_path");
            }
            $fcgi_tpl = new tpl();
            $fcgi_tpl->newTemplate("php-fcgi-starter.master");
            $fcgi_tpl->setVar('php_ini_path',$web_config["fastcgi_phpini_path"]);
            $fcgi_tpl->setVar('document_root',$data["new"]["document_root"]);
            $fcgi_tpl->setVar('php_fcgi_children',$web_config["fastcgi_children"]);
            $fcgi_tpl->setVar('php_fcgi_max_requests',$web_config["fastcgi_max_requests"]);
            $fcgi_tpl->setVar('php_fcgi_bin',$web_config["fastcgi_bin"]);
            $fcgi_starter_script = escapeshellcmd($fastcgi_starter_path."/".$web_config["fastcgi_starter_script"]);
            file_put_contents($fcgi_starter_script,$fcgi_tpl->grab());
            unset($fcgi_tpl);
            exec("chmod 755 $fcgi_starter_script");
            exec("chown ".$data["new"]["system_user"].":".$data["new"]["system_group"]." $fcgi_starter_script");
            $tpl->setVar('fastcgi_alias',$web_config["fastcgi_alias"]);
            $tpl->setVar('fastcgi_starter_path',$fastcgi_starter_path);
        }
        $vhost_file = escapeshellcmd($web_config["vhost_conf_dir"].'/'.$data["new"]["domain"].'.vhost');
        file_put_contents($vhost_file,$tpl->grab());
        $app->log("Writing the vhost file: $vhost_file",LOGLEVEL_DEBUG);