Adding Apache2 Proxy Redirect

Hi,

I am trying to create an Apache Proxy Redirect for Mopidy with Mopify web frontend on Ubuntu 14 but I can’t get it to work - any thoughts?

I am able to get the service running, it seems, and integrated with Spotify (although nothing plays) but I cannot see any of my local music - I just get the no connection error message.

Any help would be really apreciated - thanks.

Mopify UI settings

Mopidy IP address: 127.0.0.1
Mopidy Port: 6680

Error message (on Mopify web UI)

NO CONNECTION - MOPIDY

Start up

sudo dpkg-reconfigure mopidy
sudo service mopidy start

Mopidy config

[mopify]
enabled = true
debug = false

[http]
enabled = true
hostname = 127.0.0.1
port = 6680
zeroconf = Mopidy HTTP server on $hostname

[stream]
enabled = true
protocols = 
  http
  https
  mms
  rtmp
  rtmps
  rtsp

[file]
enabled = true
media_dirs = /data/music
show_dotfiles = false
follow_symlinks = false
metadata_timeout = 1000

[local]
enabled = true
library = json
media_dir = /data/music
scan_timeout = 1000
scan_flush_threshold = 100
scan_follow_symlinks = false
excluded_file_extensions = 
  .directory
  .html
  .jpeg
  .jpg
  .log
  .nfo
  .png
  .txt

Apache2 config file

<VirtualHost *:443>
  ServerName mopify.example.com
  ServerAlias mopify.example.com
  ServerSignature Off

  SSLEngine On
  SSLCertificateFile /etc/certs/cert.pem
  SSLCertificateKeyFile /etc/certs/privkey.pem
  SSLCertificateChainFile /etc/certs/chain.pem

  SSLProtocol all -SSLv2
  SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM
  SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown

  <Proxy *>
    Order deny,allow
    Allow from all
  </Proxy>

  ProxyRequests Off
  ProxyPreserveHost On
  ProxyPass / http://127.0.0.1:6680/
  ProxyPassReverse / http://127.0.0.1:6680/

  RewriteEngine on
  RewriteCond %{REQUEST_URI} !^/mopify
  RewriteRule ^/$ /mopify/$1 [R,L]

  SSLProxyEngine on

  <Location /:/mopidy/ws>
    ProxyPass wss://127.0.0.1:6680/:/mopidy/ws
    ProxyPassReverse wss://127.0.0.1:6680/:/mopidy/ws
  </Location>
</VirtualHost>

It’s not possible MPD forwarding trough http proxy do you need a tcp proxy.

This nginx config works for me:

location /mopidy/ {

    rewrite /mopidy/(.*) /mopidy/$1 break;
    proxy_pass http://localhost:6680/;
    proxy_set_header        HOST $host/mopidy;
    proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header        X-Real-IP $remote_addr;
}

location /mowecl/ {
    rewrite /mowecl/(.*) /mowecl/$1 break;
    proxy_pass http://localhost:6680;

    proxy_set_header        Host $host;
    proxy_set_header        X-Real-IP $remote_addr;
    proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;

}