Commit 9b9ba428 authored by daniel's avatar daniel

No commit message

No commit message
parent 8a05d762
......@@ -174,6 +174,23 @@ if($install_mode == 'Standard') {
//* 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
......
......@@ -691,7 +691,17 @@ class installer_base {
// 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");
......
......@@ -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>
......
......@@ -31,4 +31,11 @@ getmail_config_dir=/etc/getmail
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
\ No newline at end of file
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
\ No newline at end of file
......@@ -174,6 +174,24 @@ if($reconfigure_services_answer == 'yes') {
//** 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
......
......@@ -154,7 +154,6 @@ class page_action extends tform_actions {
}
$app->tpl->setVar("client_group_id",$client_select);
}
parent::onShowEnd();
......
......@@ -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
......
......@@ -374,6 +374,43 @@ class apache2_plugin {
}
$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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment