Mopidy Raspberry Pi and Nginx

Hello,

I installed Mopidy on Raspberry Pi. I want to control it by web clients, on the same wifi network. I enabled the http extension. If I change the hostname parameter in the [http] part in the mopidy.conf file, I’m able to reach the Raspberry Pi by http:// 192.168.0.200:6680.
But I would like to avoid the 6680 port ( lazyness ), so I installed nginx and configured it, like this link describes ( https://gist.github.com/BenMatheja/9230138 ).
When I try to reach the Raspberry pi over http:// 192.168.0.200, it gives me 502 bad gateway error, and in the nginxe error.log it says “Connection refused 111”.

Do you know what is the right configuration ?

Thank you

I was looking at this ages ago (needs revisiting) and we were using this config https://github.com/jcass77/Pi-MusicBox/blob/288891edc8653eb4e445599ada01f4d29cd8dd7a/filechanges/etc/nginx/sites-available/default

Haven’t tried this yet myself, but for simply redirecting port 80 to another local port there shouldn’t be any need to install an additional HTTP server: https://wiki.debian.org/Firewalls-local-port-redirection

100% agree with @tkem and that’s what we currently use in musicbox.

A reverse proxy can give you some extra features (and is one reason we will move to it) but for simplicity, ip tables is great.

Thank you for the quick answers. I did as you suggested and it’s all ok now! Great

Hello,
Has anyone here in the forum tried to redirect an mopidy extension to an auth/login page
via nginx? The idea behind is to accept public access for mopidy-party,
and restricted access for mopidy-mobile.

My current (working) nginx config to shorten the path for mopidy-party:

server {
listen 80 default_server;
server_name _;

    location / {
            proxy_buffering off;
            proxy_pass http://127.0.0.1:6680;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            rewrite /mopidy/(.*) /mopidy/$1 break;
            rewrite /(.*) /party/$1 break;
            proxy_redirect off;
    }

}

Is there a way to add a locations block which could do this?

Thanks in advance.