function BuildArticaInNginx() { $sock = new sockets(); $unix = new unix(); $BuildFrameWorkInNginx = false; $EnableArticaFrontEndToNGninx = intval($sock->GET_INFO("EnableArticaFrontEndToNGninx")); if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: Nginx, EnableArticaFrontEndToNGninx = {$EnableArticaFrontEndToNGninx}\n"; } if ($EnableArticaFrontEndToNGninx == 0) { return; } $SargOutputDir = $sock->GET_INFO("SargOutputDir"); if ($SargOutputDir == null) { $SargOutputDir = "/var/www/html/squid-reports"; } if (!is_dir($SargOutputDir)) { @mkdir($SargOutputDir, 0755, true); } if (!is_file("{$SargOutputDir}/logo.gif")) { @copy("/usr/share/artica-postfix/css/images/logo.gif", "{$SargOutputDir}/logo.gif"); } if (!is_file("{$SargOutputDir}/pattern.png")) { @copy("/usr/share/artica-postfix/css/images/pattern.png", "{$SargOutputDir}/pattern.png"); } $phpfpm = $unix->APACHE_LOCATE_PHP_FPM(); $EnablePHPFPM = $sock->GET_INFO("EnablePHPFPM"); $EnableArticaApachePHPFPM = $sock->GET_INFO("EnableArticaApachePHPFPM"); if (!is_numeric($EnableArticaApachePHPFPM)) { $EnableArticaApachePHPFPM = 0; } if ($EnableArticaApachePHPFPM == 0) { $EnablePHPFPM = 0; } $EnableSargGenerator = $sock->GET_INFO("EnableSargGenerator"); if (!is_numeric($EnableSargGenerator)) { $EnableSargGenerator = 1; } if (!is_numeric($EnablePHPFPM)) { $EnablePHPFPM = 0; } if (!is_file($phpfpm)) { $EnablePHPFPM = 0; } if ($EnablePHPFPM == 1) { ToSyslog("Restarting PHP5-FPM"); shell_exec("/etc/init.d/php5-fpm reload >/dev/null 2>&1"); } $host = new nginx("0.0.0.0:9000"); $host->set_ssl(); $host->set_proxy_disabled(); $host->set_DocumentRoot("/usr/share/artica-postfix"); $host->set_index_file("admin.index.php"); $host->build_proxy(); $lighttpdbin = $unix->find_program("lighttpd"); if (!is_file($lighttpdbin)) { $BuildFrameWorkInNginx = true; } if (is_file("/etc/artica-postfix/WORDPRESS_APPLIANCE")) { $BuildFrameWorkInNginx = true; } if ($EnableSargGenerator == 1) { if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: Nginx, SARG is enabled...\n"; } $host->SargDir(); $host->build_proxy(); } if ($BuildFrameWorkInNginx) { if (is_file("/etc/php5/fpm/pool.d/framework.conf")) { if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: Nginx, building framework...\n"; } $host = new nginx(47980); $host->set_proxy_disabled(); $host->set_DocumentRoot("/usr/share/artica-postfix/framework"); $host->set_framework(); $host->set_listen_ip("127.0.0.1"); $host->set_servers_aliases(array("127.0.0.1")); $host->build_proxy(); } } }