diff --git a/wp-nginx-map.php b/wp-nginx-map.php index ec241f080fc7f6b8bccc7a1761b1b31b2d154f62..c7ba8621d030b13577564ab0d9f97986a74a73dd 100644 --- a/wp-nginx-map.php +++ b/wp-nginx-map.php @@ -11,6 +11,9 @@ $noblogs_master = parse_url($master_url)['host']; define('WP_CACHE',false); require_once('/opt/noblogs/www/wp-load.php'); +// Port that the noblogs apache2 instance is listening on (as a string). +define('NOBLOGS_PORT','92'); + // Return all blogs. function get_blogs() { global $wpdb; @@ -26,10 +29,10 @@ function printline($s) { function backend_to_http_endpoint($backend) { if (substr($backend, 0, 8) != 'backend_') { error_log('diamine, di questo backend non so che farmene: ' . $backend); - return $noblogs_master . ':82'; + return $noblogs_master . ':' . NOBLOGS_PORT; } $id = substr($backend, 8); - return '172.16.1.' . $id . ':82'; + return '172.16.1.' . $id . ':' . NOBLOGS_PORT; } // Print the blog -> backend map. @@ -39,7 +42,7 @@ function generate_backend_map($blogs) { $wpdb_hash = &$wpdb->hash_map; printline('map $http_host $backend_noblogs {'); - printline(' default http://' . $noblogs_master . ':82;'); + printline(' default http://' . $noblogs_master . ':' . NOBLOGS_PORT . ';'); foreach ($blogs as $blog) { $blog_id = $blog->blog_id; if ($blog_id == 1)