blog:plex_virtual_hosting

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
blog:plex_virtual_hosting [2014/07/28 03:10] – [How it was debugged] brettblog:plex_virtual_hosting [2019/12/13 21:18] (current) – [My solution] brett
Line 1: Line 1:
-====== PLEX virtual hosting ======+====== PLEX virtual host configuration ======
  
-I had googled all around trying to find a solution to the problem of virtual hosting a plex installation and hiding the URL for the port and making '/' just do the right thing.+I had googled all around trying to find a solution to the problem of setting up a virtual host configuration for a plex installation and hiding the URL for the port and making '/' just do the right thing. 
 + 
 +Instead of typing this into a browser 
 +<code> 
 +http://cheese.local:32400/web/index.html 
 +</code> 
 +I want to be able to enter this 
 +<code> 
 +http://plex.local/ 
 +</code>
  
 This was pretty damn close: http://matt.coneybeare.me/how-to-map-plex-media-server-to-your-home-domain/ This was pretty damn close: http://matt.coneybeare.me/how-to-map-plex-media-server-to-your-home-domain/
  
-However it did not completely work and required a small adjustment+However it did not completely work and required a small adjustment for my Plex server running on CentOS.
  
 ===== My solution ===== ===== My solution =====
  
-Modify my DNS server to setup a CNAME for cheese this already hosts webserver on port 80 and its where I also want to run PLEX.+Modify my DNS server to setup a CNAME for cheese this already hosts an apache webserver on port 80 and its where I also run PLEX.
 <code> <code>
 cheese          IN      A       192.168.1.20 cheese          IN      A       192.168.1.20
Line 32: Line 41:
     ProxyRequests off     ProxyRequests off
     ProxyPreserveHost On     ProxyPreserveHost On
 +    ProxyPass / ws://127.0.0.1:32400/
 +    ProxyPassReverse / ws://127.0.0.1:32400/
 +    ProxyPass / wss://127.0.0.1:32400/
 +    ProxyPassReverse / wss://127.0.0.1:32400/
     ProxyPass / http://127.0.0.1:32400/     ProxyPass / http://127.0.0.1:32400/
     ProxyPassReverse / http://127.0.0.1:32400/     ProxyPassReverse / http://127.0.0.1:32400/
Line 44: Line 57:
  
 We need to preserve the host cheese so its webserver is not affected so we place this host first, then we define how the plex hostname works. We need to preserve the host cheese so its webserver is not affected so we place this host first, then we define how the plex hostname works.
-The only crucial piece of the puzzle it the QUERY_STRING conditional.  We do NOT want to redirect "/?something" into "/web?something" as this will screw things up.+The crucial piece of the puzzle is the QUERY_STRING conditional.  We do NOT want to redirect "/?something" into "/web?something" as this will screw things up. 
 + 
 +The inclusion of the WebSocket proxying is also crucial for activity feedback.  This requires the mod_proxy_wstunnel.so module which is available with apache 2.4+ 
 + 
 +As I was running CentOS 6.5 x64 which only has apache 2.2.15 I had to compile this module up myself by following the instructions here: http://notmyitblog.blogspot.com.au/2014/03/websockets-support-for-apache-httpd.html 
 + 
 +For your convenience the precompiled module {{:blog:mod_proxy_wstunnel.zip|}} which can be unzipped and dropped into /usr/lib64/httpd/modules you may need to chmod this to 755 after unzipping don't forget to enable this as well. 
 + 
 +Edit apache configuration to support websockets 
 +<code> 
 +# vi /etc/httpd/conf/httpd.conf 
 +LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so 
 +</code>
  
 +==== CentOS 7 ====
 +  * Disable SELINUX
 +  * Punch hole in firewall (or disable easier).
 +  * No need to install mod_proxy_wstunnel.
 ===== How it was debugged ===== ===== How it was debugged =====
  
-I find it useful document how somebody managed to figure out what everybody else is struggling with so here we go.+I find it useful to know how somebody managed to figure out what everybody else is struggling with so here we go.
  
 This additional QUERY_STRING conditional was figured out by enabling debug on the rewrite rules by putting this into the virtual host rewrite section. This additional QUERY_STRING conditional was figured out by enabling debug on the rewrite rules by putting this into the virtual host rewrite section.
  • blog/plex_virtual_hosting.1406517030.txt.gz
  • Last modified: 2014/07/28 03:10
  • by brett