Skip to content

Commit

Permalink
issue #725, #760 - back to use port 443 for conf but change ssl.conf …
Browse files Browse the repository at this point in the history
…to __ssl.conf to guarantee as the fist listing (more simple and better then previous revision); also fixed apache-optimize
  • Loading branch information
mustafaramadhan committed Nov 30, 2011
1 parent 4a93be0 commit 9fdaf68
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 18 deletions.
2 changes: 1 addition & 1 deletion kloxo/bin/fix/apache-optimize.php
Expand Up @@ -9,7 +9,7 @@

$list = parse_opt($argv);

$select = (isset($list['select'])) ? (int)$list['select'] : 'optimize';
$select = (isset($list['select'])) ? $list['select'] : 'optimize';

$spare = (isset($list['spare'])) ? (int)$list['spare'] : null;

Expand Down
3 changes: 2 additions & 1 deletion kloxo/file/lighttpd/~lxcenter.conf
@@ -1,7 +1,8 @@
include_shell "cat /home/lighttpd/conf/webmails/*.conf"
include_shell "cat /home/lighttpd/conf/exclusive/*.conf"
include_shell "cat /home/lighttpd/conf/defaults/*.conf"
include_shell "cat /home/lighttpd/conf/domains/*.conf"
include_shell "cat /home/lighttpd/conf/redirects/*.conf"
include_shell "cat /home/lighttpd/conf/webmails/*.conf"
include_shell "cat /home/lighttpd/conf/wildcards/*.conf"

$HTTP["host"] =~ "^errorloghack.lxlabs.com" {
Expand Down
54 changes: 39 additions & 15 deletions kloxo/httpdocs/lib/domain/web/driver/web__apachelib.php
Expand Up @@ -93,6 +93,7 @@ function updateMainConfFile()
$init_file = "/home/apache/conf/defaults/init.conf";

$vdomlist = $this->main->__var_vdomain_list;
/*
$iplist = $this->main->__var_ipaddress;
$fdata = null;
Expand All @@ -103,6 +104,16 @@ function updateMainConfFile()
$fdata .= "NameVirtualHost {$ip}:443\n\n";
}
}
*/
$iplist = os_get_allips();

$fdata = null;
foreach($iplist as $key => $ip){
if ($ip) {
$fdata .= "NameVirtualHost {$ip}:80\n";
$fdata .= "NameVirtualHost {$ip}:443\n\n";
}
}

lfile_put_contents($init_file, $fdata);

Expand Down Expand Up @@ -424,9 +435,16 @@ function createConffile()

$this->clearDomainIpAddress();

$string = null;
$string = "<VirtualHost \\\n{$this->createVirtualHostiplist("80")}";
$string = null;
$string .= "<VirtualHost \\\n";
$string .= $this->createVirtualHostiplist("80");

if (!$this->getServerIp()) {
$string .= $this->createVirtualHostiplist("443");
}

$string .= "\t\t>\n\n";

// $string .= $this->syncToPort("80", $cust_log, $err_log);

$syncto = $this->syncToPort("80", $cust_log, $err_log);
Expand Down Expand Up @@ -504,7 +522,8 @@ function createConffile()
}

$exclusiveip = true;
}
}
/*
else {
$string .= "\n#### ssl virtualhost start\n";
$string .= "<VirtualHost \\\n";
Expand Down Expand Up @@ -538,16 +557,21 @@ function createConffile()
$string .= $this->endtag();
$string .= "#### ssl virtualhost end\n";
}

*/
// $string .= "</IfModule>\n\n\n";

// --- for better appear
$string = str_replace("\t", "||||", $string);
$string = str_replace("\n", "\n\t", $string);
$string = str_replace("||||", "\t", $string);
}

$string2 = "\n\n<IfModule mod_ssl.c>\n{$string}\n</IfModule>\n\n\n";

if ($exclusiveip) {
$string2 = "\n\n<IfModule mod_ssl.c>\n{$string}\n</IfModule>\n\n\n";
}
else {
$string2 = "\n\n";
}

$string = $string1.$string2;

Expand Down Expand Up @@ -684,8 +708,7 @@ static function createCpConfig()
global $gbl, $sgbl, $login, $ghtml;

$vstring = self::staticcreateVirtualHostiplist('80');
// issue #725, #760 - disable for port 443
// $sstring = self::staticcreateVirtualHostiplist('443');
$sstring = self::staticcreateVirtualHostiplist('443');

$list = array("default" => "_default.conf", "cp" => "cp_config.conf", "disable" => "disable.conf");

Expand Down Expand Up @@ -776,7 +799,7 @@ static function getCreateWebmail($list, $isdisabled = null)

if ($rlflag === 'remote') {
$l['webmail_url'] = add_http_if_not_exist($l['webmail_url']);
$string .= "\tRedirect / \"{$l['webmail_url']}\"\n\n";
$string .= "\tRedirect / \"{$l['webmail_url']}\"\n";
} else {
// if (is_disabled($l['webmailprog'])) {
if ($isdisabled) {
Expand Down Expand Up @@ -961,19 +984,21 @@ static function createSSlConf($iplist, $domainiplist)
$string .= "\t</Virtualhost>\n";
}

// issue #725, #760 - ssl.conf must be the first file in listing
// so change name from ssl.conf to __ssl.conf

// $string .= "SSLLogFile /\n";
// $sslfile = "/etc/httpd/conf/kloxo/ssl.conf";
$sslfile = "/home/apache/conf/defaults/ssl.conf";

system("rm -rf /home/apache/conf/defaults/ssl.conf");
$sslfile = "/home/apache/conf/defaults/__ssl.conf";

$string = "<IfModule mod_ssl.c>\n{$string}\n</IfModule>\n\n";
//$string = null;
$string .= "DirectoryIndex index.php index.htm default.htm default.html\n\n";

lfile_put_contents($sslfile, $string);

// MR --- no need ssl.conf at all but need review after 6.1.7
// system("rm -rf /home/apache/conf/defaults/ssl.conf");

}

function sslsysnc($ipad)
Expand Down Expand Up @@ -1587,8 +1612,7 @@ static function createWebmailConfig()
$webdata = null;
$webdata .= "<VirtualHost \\\n";
$webdata .= self::staticcreateVirtualHostiplist("80");
// issue #725, #760 - disable for port 443
// $webdata .= self::staticcreateVirtualHostiplist("443");
$webdata .= self::staticcreateVirtualHostiplist("443");
$webdata .= "\t\t>\n\n";
$webdata .= "\tServerName webmail\n";
$webdata .= "\tServerAlias webmail.*\n\n";
Expand Down
7 changes: 6 additions & 1 deletion kloxo/httpdocs/lib/domain/web/driver/web__lighttpdlib.php
Expand Up @@ -592,8 +592,13 @@ static function createSSlConf($iplist, $domainiplist)
$string .= "}\n\n";
}

// issue #725, #760 - ssl.conf must be the first file in listing
// so change name from ssl.conf to __ssl.conf

// $sslfile = "__path_lighty_path/conf/kloxo/ssl.conf";
$sslfile = "/home/lighttpd/conf/defaults/ssl.conf";

system("rm -rf /home/lighttpd/conf/defaults/ssl.conf");
$sslfile = "/home/lighttpd/conf/defaults/__ssl.conf";

lfile_put_contents($sslfile, $string);
}
Expand Down

0 comments on commit 9fdaf68

Please sign in to comment.