1

Logitech Media Server is a streaming audio server formerly by Slim Devices known as SlimServer. It streams audio to Squeezebox devices (by Logitech), and third party devices, like Raspberry Pi-based PiCorePlayer.

When installed with default options, the Logitech Media Server is available on port 9000. The default URL is http://myserver:9000.

I would like to rewrite the URL as http://myserver/music.

From peers, I understand a reverse proxy server is required. I've attempted to use nginx for this without success. I am quite sure Apache could work for this, but have not been successful with either solution. I am eager to learn!

This article, on the SlimDevices wiki, explains the process using Apache. I followed the article, but have not been successful.

The article states to install the package libapache2-mod-proxy-html, which is not found. I understand from this article, it is no longer required. Following the instructions, it seems libapache2-mod-proxy-html is not the cause of my problem. I'm the one asking for help, so I defer to others.

The article's configuration file is:

# Slimserver Reverse Proxy Configuration
# Prepared by BV January 2008
#
# Make sure that the server cannot be abused
#
ProxyRequests Off

# The Proxy section below allows internet users
# to access the internal server

ProxyPass /slimserver/ http://localhost:9000/
ProxyHTMLURLMap http://localhost:9000 /slimserver
<Location /slimserver/>
    Order allow,deny
    Allow from all
    ProxyPassReverse / 
    SetOutputFilter proxy-html 
    ProxyHTMLURLMap / /slimserver/ 
    ProxyHTMLURLMap /slimserver /slimserver 
    RequestHeader unset Accept-Encoding
</Location>

When I implement the article's solution and attempt to access the Logitech Media Server on http://myserver/slimserver or http://myserver/slimserver, I get the proper page background, but the main content only says Loading Logitech Media Server.... Loading Logitech Media Server... screen image The URL http://myserver:9000 works. I can interact with the logitech media server normally.

I would prefer to learn the way to do this in nginx, as that's what my coworkers use today and are most familiar with. If I am shown how to do this in Apache2, I could attempt to duplicate the functionality in nginx myself as a learning experience. Once shown the right way, I will go into the Apache or nginx docs and research the details of the solution. Rewriting the URL as described above is something I've wanted to do for years [insert embarrassed face emoji here] but have not been successful.

ndemarco
  • 133
  • 12

2 Answers2

2

You can use iptables to do map requests to port 80 back to 9000:

sudo iptables -I PREROUTING -t nat -p tcp --dport 80 -j REDIRECT --to-port 9000

This will allow you to request http://myserver/ without the port number. In order to make this persistent across reboots, you'll need to install iptables-persistent

sudo apt-get install iptables-persistent
Stephen Rauch
  • 1,156
  • 6
  • 14
  • 20
J. Reeves
  • 36
  • 2
2

I haven't tried it yet, but why not just set the port to 80 when slimserver.pl is started. I run it on my work machine where I only basic user permissions.
Everything runs out of my home dir.

I have a completely standalone installation, no priviledged user to start/stop etc. It's very flexible if you dig into it.

This is a guidance for the usage of the command:

Usage: ./slimserver.pl [--audiodir ] [--daemon] [--stdio] [--logfile ] 
                       [--user ]
                       [--group ]
                       [--httpport  [--httpaddr ]]
                       [--cliport  [--cliaddr ]]
                       [--prefsfile  [--pidfile ]]
                       [--d_various]
                       --help           => Show this usage information.
                       --audiodir       => The path to a directory of your MP3 files.
                       --logfile        => Specify a file for error logging.
                       --daemon         => Run the server in the background.
                                           This may only work on Unix-like systems.
                       --stdio          => Use standard in and out as a command line interface
                                           to the server
                       --user           => Specify the user that server should run as.
                                           Only usable if server is started as root.
                                           This may only work on Unix-like systems.
                       --group          => Specify the group that server should run as.
                                           Only usable if server is started as root.
                                           This may only work on Unix-like systems.
                       --httpport       => Activate the web interface on the specified port.
                                           Set to 0 in order disable the web server.
                       --httpaddr       => Activate the web interface on the specified IP address.
                       --cliport        => Activate the command line interface TCP/IP interface
                                           on the specified port. Set to 0 in order disable the
                                           command line interface server.
                       --cliaddr        => Activate the command line interface TCP/IP
                                           interface on the specified IP address.
                       --prefsfile      => Specify the path to the preferences file
                       --pidfile        => Specify where a process ID file should be stored
                       --quiet          => Minimize the amount of text output
                       --playeraddr     => Specify the _server's_ IP address to use to connect
                                           to players
                       --streamaddr     => Specify the _server's_ IP address to use to connect
                                           to streaming audio sources
                       --nosetup        => Disable setup via http.
zx485
  • 2,249
  • 11
  • 24
  • 34
Thad
  • 21
  • 2
  • I tried that, but it changed the port for music to be broadcast to devices also. On a device, it appeared the music was playing, but no audio. – ndemarco Mar 08 '20 at 13:42