For plex, lower timeout on localhost to localhost curl and report error in debug. With local_web_path not set, a silent error happened after a long timeout.
Plex web is user facing not plex facing so use the $_SERVER settings from request. Redirect of /web/ to /wev/login.php was broken when behind firewall port mapping to ampache.
Fix indent following some commit patches from #615 pull request