I have seen a few discussions about how to run a Plex server on the same machine where a VPN like PIA , VyprVPN or otherwise is running. The problem being that the Plex server configures it's remote access and publishes the public IP address of the VPN client and the VPN provider does not allow access to the server through any port.
Apologies if this solution is elsewhere in the forum already.
I personally wanted to find a (relatively) simple solution that did not involve routing tables or running scripts and batch files. I was not averse to doing any port forwarding on my router and this solution does require port forwarding.
NOTE: This solution is for Windows . It should work with a Linux server too but a bit more reading would be required and will probably involve scripting or command line configuration of some sort but then again if you are running a Linux server you are probably used to that anyway.
Firstly, my own setup is as follows :
Windows 10 professional laptop running Plex server and VyprVPN client.The laptop is directly connected to my router via ethernet cable (although there is no reason this solution should not work for a wifeless connection too)
Problem: Plex server remote access was attempting to use the public IP of the Vypr client and thus could not be reached from the outside world.
My solution works using Dynamic DNS.
I signed up for a hostname using the noip.com DDNS service. The free service will require you to reconfirm your hostname each month and they remind you via email to do this or you can spend a few dollars to have your hostname permanently reserved on their service. Free or paid is up to you and both will work just fine.
For the purposes of this discussion lets assume I set up a DDNS hostname of "myplexhost.noip.me"
I then downloaded their dynamic update client and installed it. This client runs on the server and published your public ip to the world and associates it with your hostname.
At this point I will mention that if your physical internet router supports DDNS services then it gets even easier and their are full instructions for setting this up at the noip.com site. My own router does support ddns through noip.com and it works fine but the remainder of this post deals with the windows update client so dont worry if your router does not support it.
It should also be noted that there is a Linux version of the update client available too but that is the bit where you would have to go reading on your own if you run a linux plex server.
To continue: Once the dynamic update client from noip.com is downloaded and installed I configured it to publish my public ip address and associate it with my hostname. The instructions for that bit are simple on the site so I won't go into it in details.
Here is the first workaround however: The noip dynamic update client was publishing the public ip of my vpn client in the same way as the plex server was BUT if you go into File->Preferences in the DUC client there is an option to bind the client to a specific network adapter. In my case I set it to bind to my ethernet card and chose the option to "Detect my ip using remote methods".. The DUC client was now detecting the public ip of my router rather than of the VPN. which is what is needed. It was then associating the public ip of my router with the hostname "myplexhost.noip.me"
Now, the next step was to get the plex server configured to use this hostname.
In the plex server configuration screen under "Remote access" I set the plex server port manually to 32400.
Then under the "Network" configuration further down the left of the screen there is a section titled "Custom server access URLs.
In this section I entered the string "http://myplexhost.noip.me,https://myplexhost.noip.me" (without the quotes but include the comma between the URLs)
On this same screen I set the "Secure connections" option to "Preferred" (but you can try a different setting than "preferred" here depending on your security requirements)
I then saved this configuration and Plex server now publishes these URLs
The last step is then to port forward port 32400 on you router to port 32400 on the internal ip address of your plex server (e.g. 192.168.1.10 or whatever ip is being assigned by your router to your server) . Setting a static ip for your plex server on your router is also a good idea if you can. In theory you should also be able to use a different port number instead of 32400 as long as the same port number is configured in the plex server configuration and forwarded on your router. You may want to also check that whatever firewall solution is running on your plex server is allowing inbound connections on your chosen port.
When all this is done a plex client on the outside should now be able to connect to your plex server and a web web browser should also be able to connect to http://myplexhost.noip.me:32400 or https://myplexhost.noip.me:32400.
It should be noted that in the plex server config it will still show that remote access is still NOT working but plex clients should still be able to automatically "see" and connect to the server from the outside world via the custom URLs.
Plex clients on either your "home" network or the outise world should now be able to see your plex server with no additional configuration required on the client (handy for friends and family members!)
Hope this helps someone and is not too complicated!