echo "\nEnvironment: Production\n";
    }
}
/**********************************
****** Install Virtual Hosts ******
**********************************/
if (!is_dir($nginxSites)) {
    echo 'The intended nginx directory "/etc/nginx/sites-enabled" doesn\'t exist.\\n';
    exit;
}
// Find every configuration page on the server
$confList = shell_exec('find /var/www -name "config.php"');
$confList = explode("\n", trim($confList));
// Cycle through the list of configuration files detected
foreach ($confList as Config::$dataPage) {
    Config::$dataPage = trim(Config::$dataPage);
    // Get the lines from the file
    $lines = file(Config::$dataPage, FILE_IGNORE_NEW_LINES);
    // Cycle through the lines looking for certain markers
    foreach ($lines as $line) {
        $domain = "";
        // Check for #production, #staging, or #local (based on your set environment)
        if (strpos($line, "#" . $environment) !== false) {
            $pos = strpos($line, '= "');
            $pos2 = strpos($line, '";', $pos);
            $domain = substr($line, $pos + 3, $pos2 - $pos - 3);
            echo "\nConfiguring " . $domain . " virtual host for " . $environment . " server.";
        }
        // Configure the virtual host
        if ($domain) {
            // Prepare the exact directory to use