| « Streaming doesn't work with lighttpd mod_proxy, with stunnel it does | Reset Kiosk 0.3 » |
Subsonic media streamer to iPhone over HTTPS
I came across a wonderful media streamer, thanks to a colleague. I use mpd (music player daemon) to play music around the house, but I was really missing a way to stream it all to my phone.
Subsonic supports streaming with on the fly transcoding using lame & ffmepg. Installing it is pretty straightforward. I installed Subsonic to my Mac Mini, which sits behind my gateway (linux box).
Subsonic on OSX is just like any installer you see, just click next, next & next and you're done. Open the browser to localhost:4040 and change the password / create users / set up music directories.
You also need to install lame & ffmpeg for the transcoding to work. Subsonic on OSX assumes you use MacPorts for those, or at least it assumes the binaries are in /opt/local/bin. If you don't want macports, you can get the binaries however you want and put them in /Library/Application Support/Subsonic/transcode/.
mini:~ esav$ ls -l /Library/Application\ Support/Subsonic/transcode/ total 16 lrwxr-xr-x 1 root admin 21 Aug 9 13:40 ffmpeg -> /opt/local/bin/ffmpeg lrwxr-xr-x 1 root admin 19 Aug 9 13:40 lame -> /opt/local/bin/lame
To install ffmepg & lame just download MacPorts and do
mini:~ esav$ sudo port selfupdate mini:~ esav$ sudo port install lame mini:~ esav$ sudo port install ffmpeg
Getting HTTPS requires some additional work. And unfortunately it won't work with the web ui, but it does work with the REST API subsonic provides. Web UI has some issues with redirecting. For example the login page forces the page to http:// instead of https://.
I have the router/gateway machine running linux & lighttpd so my setup goes like this:
Create a self-signed cert for next 10 years ![]()
kippo ~ # openssl req -new -x509 -keyout /etc/lighttpd/server.pem -out /etc/lighttpd/server.pem -days 3650 -nodes
Configure lighttpd, create a new 'server' which listens to a port you choose, and set it up to proxy the traffic to your subsonic server.
$SERVER["socket"] == ":44300" {
ssl.engine = "enable"
ssl.pemfile = "/etc/lighttpd/server.pem"
proxy.server = ( "" => (
( "host" => "10.10.10.10", "port" => 4040 )
) )
}
You also need to enable mod_proxy
server.modules = (
.
.
.
"mod_proxy",
.
.
.
)
And open the port in the firewall, for example:
iptables -I INPUT 10 -p tcp --dport 44300 -j ACCEPT
Of course change the index from 10 to whatever you need. Usually appending to INPUT chain is a bad idea as the rules are processed top down, and usually you already have something to block traffic as last rule on your chain (like moving traffic to a different chain for logging & dropping etc).
Next, set your iSub Media Streamer to https://yourhost:44300/ and you're done.
I got error about user being null on the first attempt, but that fixed itself when I just deleted the server from iSub and created it again.
[2010-08-10 13:48:14,260] INFO RESTRequestParameterProcessingFilter - Authentication failed for user null