2

I am attempting to access my plex web ui through a cleaner url. Currently, you can access it at http://marvin.boldlygoingnowhere.org:32400/web/index.html. I want it to be at http://marvin.boldlygoingnowhere.org/plex

Heres what I have,

marvin:~ Marvin$ httpd -v Server version:

 Apache/2.4.16 (Unix)
Server built:   Aug 22 2015 16:51:57
Server's Module Magic Number: 20120211:47
Server loaded:  APR 1.4.8, APR-UTIL 1.5.2
Compiled using: APR 1.4.8, APR-UTIL 1.5.2
Architecture:   64-bit
Server MPM:     prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_FLOCK_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=256
 -D HTTPD_ROOT="/usr"
 -D SUEXEC_BIN="/usr/bin/suexec"
 -D DEFAULT_PIDLOG="/private/var/run/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="/private/etc/apache2/mime.types"
 -D SERVER_CONFIG_FILE="/private/etc/apache2/httpd.conf"

In

/private/etc/apache2/extra/httpd-vhosts.conf

Listen 80

    # Listen for virtual host requests on all IP addresses
    <VirtualHost *:80>
        ServerName marvin.boldlygoingnowhere.org
        ErrorLog "/private/var/log/apache2/marvin-error_log"
        CustomLog "/private/var/log/apache2/marvin-access_log" common
        ServerAdmin [email protected]
        ProxyRequests Off

        <Proxy http://marvin.boldlygoingnowhere.org/plex>

          Order deny,allow
          Allow from all

          ProxyPreserveHost off
          ProxyPass http://localhost:32400
          ProxyPassReverse http://localhost:32400

        </Proxy>
    </VirtualHost>

/private/etc/apache2/httpd.conf

Uncommented

Include /private/etc/apache2/extra/httpd-vhosts.conf

and

LoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.so

My expectation with this current setup is to be able to reach http://marvin.boldlygoingnowhere.org/plex/web, instead I get a 404.

I am a mobile software engineer, but this is one of my first adventures into networking and its beating me down pretty hard.

8
  • @r2Doeslnc, Can you please check with: ProxyPass /web http://localhost:32400/web ProxyPassReverse /web http://localhost:32400/web
    – Diamond
    Nov 16, 2015 at 15:09
  • you also need to have mod_proxy enabled.
    – Diamond
    Nov 16, 2015 at 15:26
  • Well, my mistake. With my previous config you can get to http://marvin.boldlygoingnowhere.org/web. But you need: ProxyPass /plex http://localhost:32400/web ProxyPassReverse /plex http://localhost:32400/web. This should work if mod_proxy is already enabled. You will need to restart apache whenever you make changes to a config file.
    – Diamond
    Nov 16, 2015 at 15:38
  • My module dump can be seen pastebin.com/EYaNc39f. I followed the instruction here - linuxquestions.org/questions/linux-newbie-8/… - to enable mod_proxy. You can see by the minor error with xml2enc that mod_proxy is at least being looked at.
    – r2DoesInc
    Nov 16, 2015 at 16:13
  • Have you tried with the changes I suggested?
    – Diamond
    Nov 16, 2015 at 16:53

2 Answers 2

1

A couple of things that you need to look at here:

  1. Make sure that you are using the right config file. When I installed apache 2.4 on my El Capitan machine the main configs actually point to a different directory /usr/local/etc/apache2/2.4/httpd.conf:

    $ httpd -V
    Server version: Apache/2.4.17 (Unix)
    Server built:   Nov 13 2015 19:31:42
    Server's Module Magic Number: 20120211:51
    Server loaded:  APR 1.5.2, APR-UTIL 1.5.4
    Compiled using: APR 1.5.2, APR-UTIL 1.5.4
    Architecture:   64-bit
    Server MPM:     prefork
      threaded:     no
        forked:     yes (variable process count)
    Server compiled with....
     -D APR_HAS_SENDFILE
     -D APR_HAS_MMAP
     -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
     -D APR_USE_SYSVSEM_SERIALIZE
     -D APR_USE_PTHREAD_SERIALIZE
     -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
     -D APR_HAS_OTHER_CHILD
     -D AP_HAVE_RELIABLE_PIPED_LOGS
     -D DYNAMIC_MODULE_LIMIT=256
     -D HTTPD_ROOT="/usr/local/Cellar/httpd24/2.4.17"
     -D SUEXEC_BIN="/usr/local/Cellar/httpd24/2.4.17/bin/suexec"
     -D DEFAULT_PIDLOG="/usr/local/var/run/apache2/httpd.pid"
     -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
     -D DEFAULT_ERRORLOG="logs/error_log"
     -D AP_TYPES_CONFIG_FILE="/usr/local/etc/apache2/2.4/mime.types"
     -D SERVER_CONFIG_FILE="/usr/local/etc/apache2/2.4/httpd.conf"
    
  2. For reverse proxy you can simply use something like this:

    <VirtualHost *:80>
      ServerName marvin.boldlygoingnowhere.org
      DocumentRoot /var/www/html
      ProxyPreserveHost On
      ProxyPass /plex http://127.0.0.1:32400
      ProxyPassReverse /plex http://127.0.0.1:32400
    
    </VirtualHost>
    
10
  • See updated output.
    – r2DoesInc
    Nov 15, 2015 at 21:24
  • Using your example, I get an apache 404. "The requested URL /plex was not found on this server."
    – r2DoesInc
    Nov 15, 2015 at 21:25
  • Are you overriding your VirtualHost directive somewhere else? Seems like you may have another VirtualHost *:80 somewhere else too, that is basically undefining anything that goes to /plex Thus you are getting a 404 (not found)
    – Rico
    Nov 17, 2015 at 0:58
  • The config in /Applications/Server.app/Contents/ServerRoot/Library/Server/Web/Config/Proxy/apache_serviceproxy.conf has one that was generated by the OSX Server App. You can see the details about that here - discussions.apple.com/thread/7231060
    – r2DoesInc
    Nov 17, 2015 at 4:24
  • how did you install apache ? brew?
    – Rico
    Nov 17, 2015 at 4:29
0

So, you are actually trying to access Plex Media Server with a custom URL. As you can see, it is not just a website, but a media server. Anyway, here is a simplified configuration snippet that should work, from here:

<VirtualHost *:80>
    ServerName marvin.boldlygoingnowhere.org
<Proxy *>
    Order deny,allow
    Allow from all
</Proxy>

ProxyRequests Off
ProxyPreserveHost On
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]

Please make sure that all the necessary apache modules are installed and check your apache error log to troubleshoot.

There seems to be a better solution offered by Plex. All You need to do is to register here: https://plex.tv/users/sign_in. And you can configure at your domain registrants to point marvin.boldlygoingnowhere.org to https://app.plex.tv/web/app.

Update: From further investigation it appears to me your vhost entry is ignored by apache. Also when you try to access http://marvin.boldlygoingnowhere.org, it lands on the apache document root. What you can do is try with an alternative servername like plex.yourdomain.com or set up your vhost in user directory and see what happens. The beginning part of the article here can help you out: http://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-osx-10-11-el-capitan/

11
  • Yes, that link is what I started working off of. I have more than just plex that I wanted to setup, so I was just attempting to get the basics understood so I could extend them to my specifics. Since using the plex.tv link would only solve the issue for one of my services, its not the route I really want to take.
    – r2DoesInc
    Nov 16, 2015 at 20:55
  • I have edited my answer, and as I have mentioned, you need to investigate your apache log files. I have also pointed two basic configuration errors. You can post your error log too.
    – Diamond
    Nov 16, 2015 at 20:59
  • Mod proxy is doing SOMETHING. My /var/log/apache2/service_proxy_error.log output from when I access /plex pastebin.com/huduKdLb. My /var/log/apache2/access_log when I access it, pastebin.com/JaS8duGN
    – r2DoesInc
    Nov 16, 2015 at 21:01
  • Well it seems like an well known OS X issue. They have made some changes how reverse proxy used to work on the platform. Check here: (github.com/phpmyadmin/phpmyadmin/issues/11503) and here: (discussions.apple.com/thread/7231060)
    – Diamond
    Nov 16, 2015 at 21:18
  • Ive run into the SSL thing a few times after setting up some redirects, that was going to be next on my list of things to tackle. Im not sure how this relates to my proxy issue though, can you clarify a bit?
    – r2DoesInc
    Nov 16, 2015 at 21:32

Not the answer you're looking for? Browse other questions tagged .