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.
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.