Background:
Plex, for a multi-user multi-media system, lacks detailed logging and monitoring. A colleague recently pointed out to me that another system, PlexPY exists to fill that gap. This blog post will walk through the steps I took to integrate the system into my reverse proxy and setup init scripts.
Plexpy itself, has quite good documentation here (for initial setup) and here (for creating system init scripts).
Creating a new service:
This is straightforward, and can be done by following the documentation above. No changes were necessary to have it running on Ubuntu 16.04.
- Create the user to run the service:
sudo adduser --system --no-create-home plexpy
- Change the ownership of the file structure to allow the new user to modify the files:
sudo chown plexpy:nogroup -R /opt/plexpy
- Create the init script:
sudo vi /lib/systemd/system/plexpy.service
- Put the following in the file:
[Unit] Description=PlexPy - Stats for Plex Media Server usage [Service] ExecStart=/opt/plexpy/PlexPy.py --quiet --daemon --nolaunch --config /opt/plexpy/config.ini --datadir /opt/plexpy GuessMainPID=no Type=forking User=plexpy Group=nogroup [Install] WantedBy=multi-user.target
- Reload the services, enable plexpy and start it:
sudo systemctl daemon-reload; sudo systemctl enable plexpy.service; sudo service plexpy start
Configuring Apache reverse proxy to allow access:
- Shutdown Apache and PlexPY:
sudo service plexpy stop sudo service apache2 stop
- Change the settings in PlexPY to make it work behind a reverse proxy. Edit the config file and change the lines to:
http_root = /plexpy http_proxy = 1
- Edit your Apache reverse config file for the domain hosting plexpy:
ProxyPass /plexpy http://Local_IP_of_plexpy:8181/plexpy/ ProxyPassReverse /plexpy http://Local_IP_of_plexpy:8181/plexpy/
- Start the services again:
sudo service plexpy start sudo service apache2 start
- Test:
I am trying to set up PlexPy for remote access in a reverse proxy. the part I can’t find how to do is step 3. how do I create a reverse proxy file that will work properly and not break my web server. Any ideas?
Sorry for the late reply! I haven’t look at this in a while.
To answer your question, It really depends on your setup. I already had apache set to work as a reverse proxy and there is quite a bit to configure to make it do that. Have you looked at the reverse proxy documentation? https://httpd.apache.org/docs/2.4/mod/mod_proxy.html