How I can make that MPD of Mopidy listen to

Hi,

How I can make that the MPD of mopidy iris listen to 127.0.0.1 and 192.168.1.106 ?

So that I can use local and over a reverse proxy with nginx?

I don’t understand what this means.

Isn’t nginx proxy only an HTTP proxy? The MPD protocol is not the same as HTTP.

I’m mean how I can use a nginx reverse proxy on my server of my local mopidy iris when it’s on 127.0.0.1?
I have to has a second instance with a IP 192.168.106 for the reserve proxy with nginx. So it’s possible that mopidy iris listen to two IP addresses on same time? Or have I to change the hole configuration to the IP address 192.168.1.106 but how I can handle mopidy iris to listen to a other IP than the local host?

Thanks for your time and reply!

I’m sorry I still don’t understand what you are asking. Is the answer you need at Mopidy-HTTP — Mopidy 3.2.0-8-g145c1d1e documentation ?

Ok that I’m looking for!

I can now open https://mopidy.xxx.ch but can’t connect to mopidy.

 For further information about options in this file see:
#   https://docs.mopidy.com/
#
# The initial commented out values reflect the defaults as of:
#   Mopidy 3.1.0
#   Mopidy-ALSAMixer 2.0.1
#   Mopidy-File 3.1.0
#   Mopidy-HTTP 3.1.0
#   Mopidy-M3U 3.1.0
#   Mopidy-MPD 3.1.0
#   Mopidy-SoftwareMixer 3.1.0
#   Mopidy-Stream 3.1.0
#
# Available options and defaults might have changed since then,
# run `mopidy config` to see the current effective config and
# `mopidy --version` to check the current version.
[core]
cache_dir = $XDG_CACHE_DIR/mopidy
config_dir = $XDG_CONFIG_DIR/mopidy
data_dir = $XDG_DATA_DIR/mopidy
max_tracklist_length = 10000
restore_state = false

[audio]
mixer = software
mixer_volume = 75
output = pulsesink server=127.0.0.1
buffer_time = 

[softwaremixer]
enabled = true


#[alsamixer]
#card = 2
#control = Master
#min_volume = 0
#max_volume = 100
#volume_scale = cubic

[proxy]
scheme =  
hostname = 
port = 
username = 
password = 

[file]
enabled = flase
media_dirs = 
  /home/GDRIVE/mp3/
excluded_file_extensions = 
  .html
  .jpeg
  .jpg
  .log
  .nfo
  .pdf
  .png
  .txt
  .zip
show_dotfiles = false
follow_symlinks = no
metadata_timeout = 1000

[http]
enabled = true
hostname = 192.168.1.106
port = 80
zeroconf = Mopidy HTTP server on $hostname
allowed_origins = https://mopidy.xxx.ch
csrf_protection = true
default_app = mopidy

[m3u]
enabled = true
base_dir =
default_encoding = latin-1
default_extension = .m3u8
playlists_dir =

[youtube]
enabled = true

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

[spotify]
enabled = true
username = XXX
password = XXX
client_id = XXX
client_secret = XXX
bitrate = 320
volume_normalization = true
private_session = false
timeout = 10
allow_cache = true 
allow_network = true
allow_playlists = true
search_album_count = 20
search_artist_count = 10
search_track_count = 50
toplist_countries = 

[soundcloud]
auth_token = XXX
explore_songs = 50

[mpd]
enabled = true
hostname = 127.0.0.1
port = 6600
password = 
max_connections = 20
connection_timeout = 120
zeroconf = Mopidy MPD server on $hostname
command_blacklist = 
  listall
  listallinfo
default_playlist_scheme = m3u

[local]
enabled = true
max_search_results = 50000
media_dir = /home/backup/DATA/MP3/
scan_timeout = 10000
scan_flush_threshold = 100
scan_follow_symlinks = no
included_file_extensions =
   .mp3
   .flac
excluded_file_extensions =   
  .directory
  .cue
  .html
  .jpeg
  .jpg
  .log
  .nfo
  .pdf
  .png
  .txt
  .zip
  .m3u	
  .sfv
directories = 
  Albums                  local:directory?type=album
  Artists                 local:directory?type=artist
  Composers               local:directory?type=artist&role=composer
  Genres                  local:directory?type=genre
  Performers              local:directory?type=artist&role=performer
  Release Years           local:directory?type=date&format=%25Y
  Tracks                  local:directory?type=track
  Last Week's Updates     local:directory?max-age=604800
  Last Month's Updates    local:directory?max-age=2592000
timeout = 10
use_artist_sortname = false
album_art_files = 
  *.jpg
  *.jpeg
  *.png

[iris]
enabled = true
country = ch
locale = de
spotify_authorization_url = https://jamesbarnsley.co.nz/iris/auth_spotify.php
lastfm_authorization_url = https://jamesbarnsley.co.nz/iris/auth_lastfm.php
genius_authorization_url = https://jamesbarnsley.co.nz/iris/auth_genius.php
data_dir = $XDG_DATA_DIR/iris

[logging]
config_file = /etc/mopidy/logging.conf
debug_file = /etc/mopidy/mopidy-debug.log

How I can now connect from the url the mopidy server. What do I have enter or adjust configuration?

127.0.0.1
6600

or
192.168.1.106
6680 , 80 or 443

isn’t working!

Where have I to enable SSL for mopidy?

Have I to deactivate MPD?

Mpd is unrelated to all of this.

The iris wiki contains a config for nginx ssl termination. You should read the documentation for these projects you are using.

Ok I have deactivated MPD.

I found only a vhost config of nginx like this.

server {
  listen       80;
  server_name  mopidy.xxx.ch;

  location / {
    proxy_pass         http://192.168.1.106:6680/iris/;
    proxy_redirect     off;
    proxy_set_header   Host             $host;
    proxy_set_header   X-Real-IP        $remote_addr;
    proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
    proxy_set_header   Upgrade $http_upgrade;
    proxy_set_header   Connection "upgrade";
  }

  location /mopidy/ {
    proxy_pass         http://192.168.1.106:6680;
    proxy_redirect     off;
    proxy_set_header   Host             $host;
    proxy_set_header   X-Real-IP        $remote_addr;
    proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
    proxy_set_header   Upgrade $http_upgrade;
    proxy_set_header   Connection "upgrade";
  }

  location /iris/ {
    proxy_pass         http://192.168.1.106:6680/iris/;
    proxy_redirect     off;
    proxy_set_header   Host             $host;
    proxy_set_header   X-Real-IP        $remote_addr;
    proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
    proxy_set_header   Upgrade $http_upgrade;
    proxy_set_header   Connection "upgrade";
  }
}

My setup is

[http]
enabled = true
hostname = 192.168.1.106
port = 6680
zeroconf = Mopidy HTTP server on $hostname
allowed_origins = mopidy.xxx.ch
csrf_protection = true
default_app = mopidy

gateway/haproxy(192.168.1.1)—webserver(192.168.1.100)—mopidy(192.168.1.106)

The site works under 192.168.1.106:6680 and mopidy too but I can’t connect to mopidy over SSL or without with https://mopidy.xxx.ch ?
Why?

It looks like your web server is only listening on port 80. You’ll have to listen on 443 to use HTTPS.

Good point. Which is exactly what the nginx example does on the iris wiki. Did you look at that first @morta ? Then go read the nginx documentation regarding anything you don’t understand thats in that config.

Imagine how frustrating it is trying to help someone that refuses to help themself first.

Yes. I have a Haproxy which translate http traffic to https. Why should my Webserver listen to 443?

Sorry. I really understand this point of your view. My English isn’t the best. So have you a nginx config which works?

I couldn’t find a config which or explain how handle the whole thing with a proxy

I can’t understand why my webserver should listen to 443?

Or have I to force Listen http extension of mopidy to port 80 with mopidy.xxx.ch:80 in the [http] section?

I have a tcp proxy before who translate ssl traffic to non ssl

I have either studying computer scientist nor is english my mother language. Sorry for frustrating you!

I typed that into google and got numerous answers. I suggest you do the same.

I’m not trying to be rude but you need a basic understanding of how this works. If you don’t have this, you can either so some research and learn, or you should not do this because it’s a real security risk to allow access into your home network if you don’t know what you are doing.

I will protect the site with .htaccess!

The whole thing is behind a OPNsense Firewall. So I take care of my network.

Ok i will give a try with nginx on listing 443 but I have to change the whole backend of Haproxy because all others applications are on port 80 and they don’t care of 80 or 443 port. So I wasn’t in the clear that a change to port 80 would mess up the whole configuration.

Ok I changed to Port 443 but I’m not able to connect to mopidy.

How I have to adjust the settings that mopidy can connect over nginx?

server {
  listen       443;
  server_name  mopidy.xxx.ch;

  location / {
    proxy_pass         http://192.168.1.106:6680/iris/;
    proxy_redirect     off;
    proxy_set_header   Host             $host;
    proxy_set_header   X-Real-IP        $remote_addr;
    proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
    proxy_set_header   Upgrade $http_upgrade;
    proxy_set_header   Connection "upgrade";
  }

  location /mopidy/ {
    proxy_pass         http://192.168.1.106:6680;
    proxy_redirect     off;
    proxy_set_header   Host             $host;
    proxy_set_header   X-Real-IP        $remote_addr;
    proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
    proxy_set_header   Upgrade $http_upgrade;
    proxy_set_header   Connection "upgrade";
  }

  location /iris/ {
    proxy_pass         http://192.168.1.106:6680/iris/;
    proxy_redirect     off;
    proxy_set_header   Host             $host;
    proxy_set_header   X-Real-IP        $remote_addr;
    proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
    proxy_set_header   Upgrade $http_upgrade;
    proxy_set_header   Connection "upgrade";
  }
}
[http]
enabled = true
hostname = 192.168.1.106
port = 6680
zeroconf = Mopidy HTTP server on $hostname
allowed_origins = mopidy.xxx.ch
csrf_protection = true
default_app = mopidy

How would be the right settings for

HOST → default
PORT → 443
URL → mopidy.xxx.ch
SSL ON
Correct?

I got following errors in systemctl status mopidy

Mär 19 18:51:36 lapt0p mopidy[2503]:     open_result = handler.open(*handler.open_args, **handler.open_kwargs)
Mär 19 18:51:36 lapt0p mopidy[2503]:   File "/usr/lib/python3.10/site-packages/mopidy_iris/handlers.py", line 48, in open
Mär 19 18:51:36 lapt0p mopidy[2503]:     iris.add_connection(connection=self, client=client)
Mär 19 18:51:36 lapt0p mopidy[2503]:   File "/usr/lib/python3.10/site-packages/mopidy_iris/core.py", line 285, in add_connection
Mär 19 18:51:36 lapt0p mopidy[2503]:     self.broadcast(
Mär 19 18:51:36 lapt0p mopidy[2503]:   File "/usr/lib/python3.10/site-packages/mopidy_iris/core.py", line 239, in broadcast
Mär 19 18:51:36 lapt0p mopidy[2503]:     connection["connection"].write_message(json_encode(message))
Mär 19 18:51:36 lapt0p mopidy[2503]:   File "/usr/lib/python3.10/site-packages/tornado/websocket.py", line 337, in write_message
Mär 19 18:51:36 lapt0p mopidy[2503]:     raise WebSocketClosedError()
Mär 19 18:51:36 lapt0p mopidy[2503]: tornado.websocket.WebSocketClosedError

How I can fix this?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.