0

I am trying to get both Plex and OwnCloud working with Apache. I currently have Plex set up correctly, requests coming from http://server.com/ get rewritten and proxied to localhost:32400/web/. I achieve this with the following configuration:

<VirtualHost *:80>
   ServerName mattstv.xyz
   <Proxy *>
      Order deny,allow
      Allow from all
   </Proxy>

   RewriteEngine On

   RewriteCond %{REQUEST_URI} ^/owncloud$
   RewriteCond %{HTTP:X-Plex-Device} ^$
   RewriteRule ^/$ /web/$1 [P,R]

   ProxyRequests Off
   ProxyPreserveHost On
   ProxyPass / http://127.0.0.1:32400/
   ProxyPassReverse / http://127.0.0.1:32400/
</VirtualHost>

I wish to keep this setup as it keeps my family from getting confused when they see 32400/web/index.html in their browser.

I have added OwnCloud to the server and am trying to get http://server.com/owncloud to NOT get proxied or rewritten. I have a rule to check for /owncloud in the REQUEST_URI but it doesn't appear to be working.

I get the following response when going to http://server.com/owncloud

<MediaContainer size="0" content="plugins"></MediaContainer>

It looks like it's pulling the main page up but none of the scripts are resolving based on the debugger:

chrome debugger

When I completely disable the virtual host the OwnCloud URL works correctly.

From reading Apache documentation I believe the proxy will not occur if the rewrite conditions fail?

mlapaglia
  • 852
  • 14
  • 31

1 Answers1

0

Got it working with Plex, OwnCloud, and SyncThing. I added multiple ProxyPass commands for each URL I wanted to proxy.

OwnCloud listens on port 80, so that needs to bypass the proxy. SyncThing requires a trailing slash after the URL

<VirtualHost *:80>
    ServerName server.com
    ProxyRequests Off
    ProxyPreserveHost On

    #let owncloud pass straight through
    ProxyPass /owncloud !

    #syncthing doesn't work without a trailing slash in browser URL
    RewriteRule ^/syncthing$ /syncthing/ [R]
    ProxyPass /syncthing/ http://127.0.0.1:8384/
    ProxyPassReverse /syncthing/ http://127.0.0.1:8384/

    #default go to plex
    ProxyPass / http://127.0.0.1:32400/
    ProxyPassReverse / http://127.0.0.1:32400/

    RewriteEngine on
    RewriteCond %{REQUEST_URI} !^/web
    RewriteCond %{HTTP:X-Plex-Device} ^$
    RewriteRule ^/$ /web/$1 [R,L]
</VirtualHost>
mlapaglia
  • 852
  • 14
  • 31