.local refuses to connect

Hi all,

I’m using the latest mopidy and mopidy-musicbox-webclient on a Raspberry Pi 2 with the latest Jessie lite image and I can’t connect to it it through Chrome at kitchen.local. I get “This Site Can’t Be Reached, kitchen.local refused to connect.”. I just finished completely rebuilding this thing after having this issue the first time. I can connect to it at http://10.0.0.45:6680/musicbox_webclient/ no problem, but who wants to type that every time.

My config:

[core]
cache_dir = /var/cache/mopidy
config_dir = /etc/mopidy
data_dir = /var/lib/mopidy

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

[local]
data_dir = /var/lib/mopidy/local
media_dir = /var/lib/mopidy/media
enabled = true

[m3u]
playlists_dir = /var/lib/mopidy/playlists

[audio]
mixer = software
mixer_volume = 40
output = autoaudiosink
buffer_time = ""

[websettings]
enabled = true
musicbox = false
config_file = /etc/mopidy/mopidy.conf

[http]
enabled = true
hostname = 0.0.0.0
port = 6680
static_dir = ""
zeroconf = Mopidy HTTP server on $hostname

[musicbox_webclient]
enabled = true
musicbox = false
websocket_host = ""
websocket_port = ""
on_track_click = PLAY_ALL
[spotify]
enabled = true
username = 
password = 
bitrate = 320
[gmusic]
enabled = true
username = 
password = 
[tunein]
enabled = true
[podcast]
enabled = true
[internetarchive]
enabled = true
[youtube]
enabled = true
[audioaddict]

I can ssh into it at kitchen.local through putty.

Thanks

Hello,

Have you enabled ZeroConf on the Pi?

https://www.raspberrypi.org/forums/viewtopic.php?f=66&t=18207

What happens if you try and SSH into the Pi as raspberrypi.local

https://www.raspberrypi.org/forums/viewtopic.php?f=66&t=18207

PS - Have you got more than one Pi connected to the network?

Mopidy runs on port 6680. You would need to use http://kitchen.local:6680

1 Like

Yes it is installed

Yes, several, but they all have distinct hostnames.

Ah, yes, this works. Now how do I get it at port 80 so I don’t need :6680? Also I would really like to not have to even have to put /musicbox_webclient in the address either. Ideally I just wan’t to go to http://kitchen.local

How is this working on pimusicbox?

This part of startup.sh?

 #redirect 6680 to 80 
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 6680 > /dev/null 2>&1 || true

Iptables redirects 80 to 6680 and Mopidy’s (now deprecated) static site setting pointing to a web page that just redirects to musicbox webclient.

Alternatively you can use a reverse proxy such as nginx. There should be an example on here somewhere for doing this, I can fish it out later if you like.

I ran this and it is working now:

sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 6680

I can access the webpage at kitchen.local/musicbox_webclient/ now. I would still like to not have to put the /musicbox_webclient/ in the address. I tried adding it in the http section but that didn’t work -

[http]
enabled = true
hostname = 0.0.0.0
port = 6680
static_dir = musicbox_webclient
zeroconf = Mopidy HTTP server on $hostname

How do I get kitchen.local to take me to the mopidy-musicbox-webclient site?

Right now going to kitchen.local takes me to kitchen.local/mopidy where there is a link to take me to kitchen.local/musicbox_webclient.

You say that this is depricated now?

Hi, sorry for the delay.

Yes, the static_dir option is deprecated so it’ll be removed in the next major release (so probably not that soon).

So you can try the following hacky fix to get things working again:

sudo mkdir /opt/webclient
echo "<html><head><meta http-equiv=\"refresh\" content=\"0; URL=/musicbox_webclient/index.html\"></head><body>Web interface moved, <a href=\"/musicbox_webclient/index.html\">click here</a></body></html>" | sudo tee /opt/webclient/index.html

And then set static_dir = /opt/webclient in the [http] section of your /etc/mopidy/mopidy.conf file.

A better solution going forward would be to use a reverse proxy such as nginx. An example configuration file for nginx can be found here.

Thanks, I’ll give those a try.