Example #1
0
function build_default_asArtica()
{
    $nginx = new nginx();
    $unix = new unix();
    $squidR = new squidbee();
    $f[] = "server {";
    $f[] = "\tlisten       80;";
    $f[] = "\tserver_name  " . $unix->hostname_g() . ";";
    $f[] = "\tindex     logon.php;";
    $f[] = "\tlocation /nginx_status {";
    $f[] = "\tstub_status on;";
    $f[] = "\terror_log  /var/log/nginx/default.error.log warn;";
    $f[] = "\taccess_log   /var/log/nginx/default.access.log;";
    $f[] = "\tallow all;";
    $f[] = "\t}";
    $f[] = "\tlocation / {";
    $f[] = "\t\troot\t/usr/share/artica-postfix;";
    $f[] = "\t}";
    $f[] = $nginx->php_fpm("logon.php", "/usr/share/artica-postfix", 1);
    $f[] = "}";
    $f[] = "server {";
    $f[] = "\tlisten       443;";
    $f[] = "\tindex     logon.php;";
    $f[] = "\tkeepalive_timeout   70;";
    $f[] = "\terror_log  /var/log/nginx/default.error.log warn;";
    $f[] = "\taccess_log   /var/log/nginx/default.access.log;";
    $f[] = "\tssl on;";
    $f[] = "\t" . $squidR->SaveCertificate($unix->hostname_g(), false, true);
    $f[] = "\tssl_session_timeout  5m;";
    $f[] = "\tssl_protocols  SSLv3 TLSv1;";
    $f[] = "\tssl_ciphers HIGH:!aNULL:!MD5;";
    $f[] = "\tssl_prefer_server_ciphers   on;";
    $f[] = "\tserver_name  " . $unix->hostname_g() . ";";
    $f[] = "\tlocation / {";
    $f[] = "\t\troot\t/usr/share/artica-postfix;";
    $f[] = "\t}";
    $f[] = $nginx->php_fpm("logon.php", "/usr/share/artica-postfix", 1);
    $f[] = "}";
    @file_put_contents("/etc/nginx/conf.d/default.conf", @implode("\n", $f));
    if ($GLOBALS["RELOAD"]) {
        reload(true);
    }
}