public static function updateNginxRedirection() { foreach (self::listServerZwave(false) as $zwave) { if (trim($zwave['addr']) == '' || trim($zwave['port']) == '') { continue; } $urlPath = config::byKey('urlPath' . $zwave['id'], 'openzwave'); if ($urlPath == '') { $urlPath = 'openzwave_' . $zwave['id'] . '_' . config::genKey(30); config::save('urlPath' . $zwave['id'], $urlPath, 'openzwave'); } $rules = array("location /" . $urlPath . "/ {\n" . "proxy_pass http://" . $zwave['addr'] . ":" . $zwave['port'] . "/;\n" . "proxy_redirect off;\n" . "proxy_set_header Host \$host:\$server_port;\n" . "proxy_set_header X-Real-IP \$remote_addr;\n" . "}"); network::nginx_saveRule($rules); } }