How to Install Plex Requests on Ubuntu 16.04, 18.04 Server

This tutorial will be showing you how to install Plex Requests on Ubuntu 16.04 and Ubuntu 18.04 server. Plex Requests is a simple automated way for users to request new content on your Plex media server.

Plex Requests allows your users to submit content requests on a dedicated web page. The latest version is v1.21.2, released on Feb 16, 2018. Features of Plex Requests are as follows:

  • Users can easily search the TheMovieDB for content to request
  • Handy list of requested movies and TV series and basic issue reporting
  • Simple user authentication with new approval system
  • CouchPotato integration for automatic downloads of movies
  • SickRage and Sonarr integration for automatic TV Series downloads
  • Pushbullet or Pushover notifications to keep up to date with requests

plex requests nginx subdirectory

Prerequisites

To follow this tutorial, it’s assumed that you have already set up Plex media server on Ubuntu 16.04 or Ubuntu 18.04. You can check out the following articles.

To run Plex Requests, your server must have at least 1GB of RAM. 2GB is recommended to run it smoothly. Without further ado, let’s install Plex Requests.

Install Plex Requests on Ubuntu 16.04, 18.04 Server

Plex Requests is written with MeteorJS, which is a free and open-source JavaScript web framework for building web and mobile apps. To run Plex Requests, we need to install MeteorJS with the following command.

sudo apt install curl

curl https://install.meteor.com/ | sh

install meteorjs on ubuntu 16.04 18.04

Then head over to Github and download the latest release.

plex requests meteor

To download it from command line, use the following command. If a new version comes out, simply replace 1.12.2 with the new version number.

wget -O plexrequests-meteor-1.21.2.zip https://codeload.github.com/lokenx/plexrequests-meteor/zip/v1.21.2

Next, unzip the archive.

sudo apt install unzip

unzip plexrequests-meteor-1.21.2.zip

Cd into the directory.

cd plexrequests-meteor-1.21.2/

Now we can run Plex Requests with the following command.

meteor

Note that if your server doesn’t have enough RAM, this command will fail and you will see the following error. ENOMEM stands for “Error – No Memory”.

Error: spawn ENOMEM

Also, Plex Requests by default listens on port 3000. If another application is using port 3000, then specify an alternative port like 3002. (MongoDB listens on port 3001.)

meteor --port 3002

plex requests meteor port 3000

Now you can access the Plex Requests admin page at

your-server-ip:3000/admin

If port 3000 is blocked by firewall, then run the following command to allow access on port 3000.

sudo iptables -I INPUT -p tcp --dport 3000 -j ACCEPT

plex requests create admin account
Click the Register link to create an admin account.

Plex Requests login forbidden

Run Plex Requests in the background with SystemD

By default, the meteor command runs in the foreground, which means if you quit the terminal, Plex Requests will stop running. To run it in the background, we can create a SystemD service. First, press Ctrl+C to stop the current meteor process. Then create a SystemD service file for Plex Requests with a command line text editor like nano.

sudo nano /etc/systemd/system/plex-requests.service

In this file, we need to set the HOME environment variable, set the working directory and specify that meteor will run as a standard user. So put the following text into this file. Replace the red text as appropriate.

[Unit]
Description=Plex Requests
After=syslog.target network.target

[Service]
Environment="HOME=/home/linuxbabe"
WorkingDirectory=/home/linuxbabe/plexrequests-meteor-1.21.2
ExecStart=/usr/local/bin/meteor
Type=simple
Restart=always
RestartSec=10
User=linuxbabe
Group=linuxbabe

[Install]
WantedBy=multi-user.target

To save the file in Nano text editor, press Ctrl+O, then press Enter to confirm. To exit, press Ctrl+X. Next, we can start the SystemD service with:

sudo systemctl start plex-requests

And enable auto-start at system boot time.

sudo systemctl enable plex-requests

Now check the status:

systemctl status plex-requests

Make sure it’s running. Then press q to gain back control of terminal.

meteor plex requests systemd run in the background

Set up Nginx Reverse Proxy (Subdomain)

To access Plex Requests via a domain name instead of typing IP address and port number, you can set up a reverse proxy with Nginx. Run the following command install Nginx web server.

sudo apt install nginx

Then create a Nginx virtual host file for Plex Requests.

sudo nano /etc/nginx/conf.d/plex-requests.conf

Put the following lines into the file. Replace requests.example.com with your own domain name. Don’t forget to set A record for the sub domain. The location / {…} block will make Nginx redirect requests to port 3000.

server {
    listen 80;
    server_name requests.example.com;

    error_log /var/log/nginx/plex-requests.error;

    location / {
          proxy_pass http://127.0.0.1:3000;
          proxy_set_header Host $host;
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          #upgrade to WebSocket protocol
          proxy_set_header Upgrade $http_upgrade;
          proxy_set_header Connection "Upgrade";
    }
}

Save and close the file. Then test Nginx configuration.

sudo nginx -t

If the test is successful, then reload Nginx for the new configuration to take effect.

sudo systemctl reload nginx

Now Plex Requests is put behind Nginx and you can access it via a domain name (requests.example.com).

To enable HTTPS secure connection, you can obtain and install a free TLS/SSL certificate from Let’s Encrypt. Install Let’s Encrypt (certbot) client with:

sudo apt install software-properties-common
sudo add-apt-repository ppa:certbot/certbot
sudo apt update
sudo apt install certbot python3-certbot-nginx

Then issue the following command, which uses Certbot Nginx plugin to automatically obtain and install TLS certificate. Replace red text with your actual data.

sudo certbot --nginx --agree-tos --redirect --hsts --staple-ocsp --email your-email-address --domain requests.example.com

Within a few seconds, you should see a congrats message like below which means the certificate is successfully obtained.

plex requests certbot

Refresh the Plex Requests web page, you will find HTTP connection is automatically redirected to HTTPS secure connection.

Set Up Nginx Reverse Proxy (Subdirectory)

If you want Plex Requests accessible via a subdirectory of your domain, then open the existing Nginx virtual host file for your Plex media server. Mine is named plex.conf.

sudo nano /etc/nginx/conf.d/plex.conf

If you followed my previous Plex media server tutorial, then you should now have HTTPS enabled for your Plex media server. And you just need to add the following lines to the SSL server block (indicated by listen 443 ssl).

 location ~* (/search|/admin|/requests|/packages|/sockjs|/app|/merged-stylesheets.css) {
        proxy_pass http://localhost:3000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";

 }

In the above configuration, we specify that if the request URL ends in /search, /admin, /requests, /packages, /sockjs, /app, or /merged-stylesheets.css, then tell Nginx to redirect request to port 3000. If the request URL ends in /sockjs, there will be some WebSocket requests along with normal HTTP requests, so we add the last two proxy_set_header directives to upgrade to WebSocket protocol.

Save and close the file. Then test Nginx configuration.

sudo nginx -t

If the test is successful, then reload Nginx for the new configuration to take effect.

sudo systemctl reload nginx

Now the main Plex Requests webpage is accessible via a sub-directory.

example.com/search

And the admin page is accessible via

example.com/admin

Set up Apache Reverse Proxy (Subdomain)

If you prefer Apache to Nginx, then install it with:

sudo apt install apache2

To use Apache as a reverse proxy, we need to enable the proxy modules and the header module.

sudo a2enmod proxy proxy_http proxy_wstunnel headers

Then create a virtual host file for Plex Requests.

sudo nano /etc/apache2/sites-available/plex-requests.conf

Put the following lines into the file. Replace requests.example.com with your own domain name. Don’t forget to set A record for the sub domain.

<VirtualHost *:80>
    ServerName requests.example.com
    ErrorDocument 404 /404.html
    
    #HTTP Requests
    ProxyPass / http://localhost:3000/
    ProxyPassReverse / http://localhost:3000/
    
    #When protocol upgrade to Websocket is received, change the origin (protocol scheme, host and port)
    RewriteEngine on
    RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
    RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]
    RewriteRule .* ws://localhost:3000%{REQUEST_URI} [P]
</VirtualHost>

Save and close the file. Then enable this virtual host.

sudo a2ensite plex-requests.conf

Restart Apache

sudo systemctl restart apache2

Now Plex Requests is put behind Apache and you can access it via a domain name (requests.example.com).

To enable HTTPS secure connection, you can obtain and install a free TLS/SSL certificate from Let’s Encrypt. Install Let’s Encrypt (certbot) client with:

sudo apt install software-properties-common
sudo add-apt-repository ppa:certbot/certbot
sudo apt update
sudo apt install certbot python3-certbot-apache

Then issue the following command, which uses Certbot Nginx plugin to automatically obtain and install TLS certificate. Replace red text with your actual data.

sudo certbot --apache --agree-tos --redirect --hsts --staple-ocsp --email your-email-address --domain requests.example.com

Within a few seconds, you should see a congrats message like below which means the certificate is successfully obtained.

plex requests certbot

Refresh the Plex Requests web page, you will find HTTP connection is automatically redirected to HTTPS secure connection.

Set up Apache Reverse Proxy (Subdirectory)

If you want Plex Requests accessible via a subdirectory of your domain, then open the existing Apache virtual host file for your Plex media server. Mine is named plex-le-ssl.conf. (Note that you need to edit the virtual host that listens on 443.)

sudo nano /etc/nginx/conf.d/plex-le-ssl.conf

If you followed my previous Plex media server tutorial, then you should now have HTTPS enabled for your Plex media server. And you just need to add the following lines inside the <VirtualHost *:443>...</VirtualHost> block.

    RewriteEngine on

    #If the requested URL is meant for Plex Requests, then redirect the request to localhost:3000
    RewriteCond %{REQUEST_URI} ^/(search|admin|requests|packages|app|sockjs|merged-stylesheets.css) [NC]
    RewriteRule .* http://localhost:3000%{REQUEST_URI} [P]

    #This is for Websocket requests.
    <Location /sockjs/>
       RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
       RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]
       RewriteRule .* ws://localhost:3000%{REQUEST_URI} [P]
    </Location>

Save and close the file. Then reload Apache for the changes to take effect.

sudo systemctl reload apache2

Now the main Plex Requests webpage is accessible via a sub-directory.

example.com/search

And the admin page is accessible via

example.com/admin

Conclusion

I hope this tutorial helped you install Plex Requests on Ubuntu 18.04 and 16.04. As always, if you found this post useful, then subscribe to our free newsletter to get more tips and tricks. Take care 🙂

Rate this tutorial
[Total: 1 Average: 5]

2 Responses to “How to Install Plex Requests on Ubuntu 16.04, 18.04 Server

  • Hi Xiao

    I was just wondering is there a way of completely removing Plex Requests from an Ubuntu server 18.04?

    Thanks
    Mark

    • Xiao Guoan (Admin)
      5 years ago

      To remove Plex Request,

      1.) Stop and disable the plex-requests.service.

      sudo systemctl stop plex-requests.service
      sudo systemctl disable plex-requests.service

      2.) Disable the Nginx configuration file.

      sudo mv /etc/nginx/conf.d/plex-requests.conf /etc/nginx/conf.d/plex-requests.conf.backup

      Then reload Nginx.

      sudo systemctl reload nginx

      or disable the Apache virtual host.

      sudo a2dissite plex-requests.conf
      sudo a2dissite plex-requests-le-ssl.conf

      Then reload Apache.

      sudo systemctl reload apache2

Leave a Comment

  • Comments with links are moderated by admin before published.
  • Your email address will not be published.
  • Use <pre> ... </pre> HTML tag to quote the output from your terminal/console.
  • Please use the community (https://community.linuxbabe.com) for questions unrelated to this article.
  • I don't have time to answer every question. Making a donation would incentivize me to spend more time answering questions.

The maximum upload file size: 2 MB. You can upload: image. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded. Drop file here