Plex not listening to any port, connection refused on Apache2 (subdomain) [Solved]

Hello,

I recently installed plex on my Debian 10 server but sadly cannot access its plex webpage. I’m not that great at network so I probably configured it wrong. But I can’t figure out where I messed.

I (tried to) configured subdomains and http -> https redirection (certificate provided by certbot). I’m using the following vhosts :

plex-le-redirect.conf :

<VirtualHost *:80>
        ServerName media.hijackedbrain.com

        ServerSignature Off

        RewriteEngine On
        RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]

        ErrorLog /var/log/apache2/redirect.error.log
        LogLevel warn
</VirtualHost>

plex.conf :

<IfModule mod_ssl.c>
<VirtualHost *:443>
        ServerName media.hijackedbrain.com

        <Proxy *>
                Order deny,allow
                Allow from all
        </Proxy>

        ProxyRequests Off
        ProxyPreserveHost On
        ProxyPass / https://hijackedbrain.com:32400/
        ProxyPassReverse / https://hijackedbrain.com:32400/

        RewriteEngine on
        RewriteCond %{REQUEST_URI} !^/web
        RewriteCond %{HTTP:X-Plex-Device} ^$
        RewriteRule ^/$ /web/$1 [R,L]

        SSLCertificateFile /etc/letsencrypt/live/hijackedbrain.com/fullchain.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/hijackedbrain.com/privkey.pem

</VirtualHost>
</IfModule>

But whenever I try to access the plex webpage, it gives me a 503 error and print this into apache2’s error log :

[Sat Aug 03 19:08:46.843994 2019] [proxy:error] [pid 12082] (111)Connection refused: AH00957: HTTPS: attempt to connect to 163.172.82.14:32400 (hijackedbrain.com) failed
[Sat Aug 03 19:08:46.844053 2019] [proxy_http:error] [pid 12082] [client 178.18.61.242:55100] AH01114: HTTP: failed to make connection to backend: hijackedbrain.com
[Sat Aug 03 19:08:47.414056 2019] [proxy:error] [pid 12081] (111)Connection refused: AH00957: HTTPS: attempt to connect to 163.172.82.14:32400 (hijackedbrain.com) failed
[Sat Aug 03 19:08:47.414116 2019] [proxy_http:error] [pid 12081] [client 178.18.61.242:55101] AH01114: HTTP: failed to make connection to backend: hijackedbrain.com

So I’m guessing I did something wrong with ProxyPass but what exactly ? Thanks to whoever spent 2 minutes reading this. And more thanks if you’re responding.


EDIT : tldr version of this thread. Somehow the .deb didn’t install correctly. Thus the installation was corrupted, and the server wasn’t running at all … So it wasn’t a vhosts issues at all. I had to to use a beta build of the installer (linked in messages below) to install it on debian 10 somehow. Once it was up and running everything was dandy and fine.


Server Version#: latest 1.16.3.1402-22929c8a2 - July 15, 2019
Player Version#: none

Bump and update.

I tried taking inspirations from other plex vhosts conf file out there like those ones :


yet it always ends the same way.

[Thu Aug 08 22:52:28.292452 2019] [proxy:error] [pid 14338] (111)Connection refused: AH00957: HTTP: attempt to connect to 163.172.82.14:32400 (media.hijackedbrain.com) failed
[Thu Aug 08 22:52:28.292551 2019] [proxy_http:error] [pid 14338] [client 178.18.61.242:54992] AH01114: HTTP: failed to make connection to backend: media.hijackedbrain.com
[Thu Aug 08 22:52:28.292973 2019] [proxy:error] [pid 14339] (111)Connection refused: AH00957: HTTP: attempt to connect to 163.172.82.14:32400 (media.hijackedbrain.com) failed
[Thu Aug 08 22:52:28.293063 2019] [proxy_http:error] [pid 14339] [client 178.18.61.242:54991] AH01114: HTTP: failed to make connection to backend: media.hijackedbrain.com

Looks like plex is running but not listening to any port …

root@VALIS:~# ss -tnlp | grep apache2                                                                    LISTEN    0         511                      *:80                     *:*        users:(("apache2",pid=32241,fd=4),("apache2",pid=31624,fd=4),("apache2",pid=31623,fd=4),("apache2",pid=31622,fd=4),("apache2",pid=31621,fd=4),("apache2",pid=31620,fd=4),("apache2",pid=31619,fd=4),("apache2",pid=16379,fd=4),("apache2",pid=16340,fd=4),("apache2",pid=3337,fd=4),("apache2",pid=1377,fd=4),("apache2",pid=951,fd=4))
LISTEN    0         511                      *:443                    *:*        users:(("apache2",pid=32241,fd=6),("apache2",pid=31624,fd=6),("apache2",pid=31623,fd=6),("apache2",pid=31622,fd=6),("apache2",pid=31621,fd=6),("apache2",pid=31620,fd=6),("apache2",pid=31619,fd=6),("apache2",pid=16379,fd=6),("apache2",pid=16340,fd=6),("apache2",pid=3337,fd=6),("apache2",pid=1377,fd=6),("apache2",pid=951,fd=6))
root@VALIS:~# ss -tnlp | grep plex
root@VALIS:~# service plexmediaserver status
â plexmediaserver.service - Plex Media Server
   Loaded: loaded (/lib/systemd/system/plexmediaserver.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2019-08-09 23:04:34 CEST; 12h ago
  Process: 459 ExecStartPre=/bin/sh -c /usr/bin/test -d "${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}" ||
 Main PID: 492 (sh)
    Tasks: 6 (limit: 4656)
   Memory: 35.5M
   CGroup: /system.slice/plexmediaserver.service
           ââ492 /bin/sh -c  PLEX_MEDIA_SERVER_INFO_VENDOR="$(grep ^NAME= /etc/os-release | awk -F= "{pri
           ââ503 /usr/lib/plexmediaserver/Plex Media Server

Aug 09 23:04:33 VALIS systemd[1]: Starting Plex Media Server...
Aug 09 23:04:34 VALIS systemd[1]: Started Plex Media Server.
lines 1-13/13 (END)
root@VALIS:~# netstat -tan | grep 32400
root@VALIS:~#

Ok so I found the two interesting directories

/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/
/usr/lib/plexmediaserver/

Logs are pretty much empty there are some startup activities in there but nothing showing up when trying to connect to it.

So I tried to start manually /usr/lib/plexmediaserver/Plex\ Media\ Server … And it was alive. The webpage is up. Why ? What’s happening ? I’m pretty sure that’s not supposed to work like that. If so why did service plexmediaserver status showed the “Plex Media Server” as active and running before ?

I’m confused

Also it’s “working” but it’s not fully functional yet as the web interface is “looking for a server” …

Have you first gotten PMS to work without all the complexities of a proxy?

1 Like

To be fair, no I straight up tried to go for the subdomain.

So I just I tried to disable the vhost of my main website and replaced it with the following : http://paste.debian.net/1095249/

And it’s not working. It’s giving me back my 503 Service unavailable error. And yes if I manually call /usr/lib/plexmediaserver/Plex\ Media\ Server I will be able to access the plex web app… But it won’t find my server.

So tldr the subdomain does’nt seem to be the culprit here.

How about you go for the basics first.

Get that working.

Then add your layers after it works, one layer at a time.

I say this because it’s impossible to know where the problem is when you drop a whole pile of “stuff” on something you don’t even having working yet. You have nothing to fall back on to get back to a working state.

Yes I know. Thats’s why I’m droping the other subdomains (for now). But PMS still need at least one vhost to run correctly does it ?

Vhost?

please clarify? as in VPS host or ??

vhost as in Apache VirtualHost. https://httpd.apache.org/docs/2.4/vhosts/examples.html
Config files so I can tell Apache “Yo, redirect this url to this. Use this folder for this subdomain, etc”
But honestly from the start I worked on the assumption that PMS needed Apache2 (or NGinx or similar) … Which now that I think about it might not be the case.

No. Not going to work. Forget that entirely.

Plex is not subservient to Apache.
Plex is its own free-standing server.
Plex provides its own web server (what you see as the Plex/Web UI)

Install the package on the Debian host.
It will run as a system service completely independent of everything else.

What can be done is a regular Proxy server can be added after you have everything working.
You can use a proxy server for your private domain redirections as you see fit provided you maintain the https cert integrity

Mokay so I will need to change its subdomain later on. But for now let’s get this thing to work. I just rebooted it, turned off every Apache2 vhosts, turned off Apache itself.

The debian package is installed, but the webpage isn’t showing up. And looking at the Plex Media Server.log file … The last entry is from more than 6 hours ago … So something is wrong. I’ll keep digging the logs in case something is showing up

Thanks for helping by the way.

  • let’s just back this out completely and begin fresh.
sudo sh
systemctl stop plexmediaserver
dpkg -r plexmediaserver
userdel plex
rm -rf /var/lib/plexmediaserver
  • Sign your browser out of Plex/web (if you have this) from the upper right corner icon.

  • Reinstall the package fresh

sudo dpkg -i  package-file-name.deb
  • give it 10-15 seconds to create new directories and configure

  • open main control and begin setup on the localhost

in the browser:

http://127.0.0.1:32400/web
1 Like

ok so … when installing the package it couldn’t create the user “âplexâ” (log here : http://paste.debian.net/1095259/ , using plexmediaserver_1.16.3.1402-22929c8a2_amd64.deb)

so I created the plex user myself… And now it’s failing the post installation scripts

I ran into similar problems the first time I installed it, I don’t remember for sure how I solved it.

The username is plex, the group name is plex.

Where did you download this package from please?

During the package installation, I do everything which is required.

This includes

  1. Create the username and group
  2. Create the directories
  3. Add user plex to the video group.
  4. Install the service control file
  5. Launch PMS.

I would like you to completely remove the package, the username, the group, and the directory again. Please let my installation scripts do the work.

From here : https://www.plex.tv/media-server-downloads/

I noted the address and wget it from the server : wget https://downloads.plex.tv/plex-media-server-new/1.16.3.1402-22929c8a2/debian/plexmediaserver_1.16.3.1402-22929c8a2_amd64.deb

Good. then please just undo everything you have done manually and let my installation scripts do all the work for you.

userdel -r plex
groupdel plex

double checked that plex user has no home anymore

dpkg -i plexmediaserver_1.16.3.1402-22929c8a2_amd64.deb

and it’s still failing with the weird symbol in the output trying to add “âplexâ”