{"id":194,"date":"2017-09-18T11:14:43","date_gmt":"2017-09-18T16:14:43","guid":{"rendered":"https:\/\/codemonkeyden.com\/blog\/?p=194"},"modified":"2023-11-10T23:04:04","modified_gmt":"2023-11-11T05:04:04","slug":"music-streaming-service-subsonic","status":"publish","type":"post","link":"https:\/\/codemonkeyden.com\/?p=194","title":{"rendered":"Host Your Own Music Streaming Service with Subsonic"},"content":{"rendered":"<h5>Motivation<\/h5>\n<p>Many people use music streaming services for the convenience and portability they can offer. However,\u00a0nearly all\u00a0of the ones I could find require the use of non-free software, use Digital Restrictions Management (DRM), and prevent you from sharing music with friends and family. All of these problems can be avoided by hosting your own music streaming service on your own server.<\/p>\n<h5>Prerequisites<\/h5>\n<p>On Debian 9 GNU\/Linux, install subsonic from the repository.<\/p>\n<pre>sudo apt-get install -y subsonic<\/pre>\n<h5>Configure Subsonic<\/h5>\n<p>The configuration file for subsonic is located at \/etc\/default\/subsonic.\u00a0Modify the SUBSONIC_USER setting to be subsonic. This improves security because if the\u00a0daemon is compromised, the intruder doesn&#8217;t get root access. Modify the SUBSONIC_ARGS to specify the context of \/subsonic, the port as 8080 and the max-memory as 150.<\/p>\n<pre>SUBSONIC_ARGS=\"--context-path=\/subsonic --port=8080 --max-memory=150\"\nSUBSONIC_USER=subsonic<\/pre>\n<h5>Issues with the Default Configuration<\/h5>\n<p>By default subsonic runs on a non-standard port and does not use\u00a0TLS encryption. Since you are entering credentials to subsonic, it a good idea to use\u00a0TLS encryption to prevent\u00a0eavesdroppers from discovering your password. While you can configure subsonic to run TLS encryption with self-signed certificate, I found it difficult to get it to use a trusted certificate. Running on a non-standard port may also require you to add an additional port-forwarding rule on your router for you to access subsonic remotely. If you already have apache setup with port-forwarding and a trusted TLS certificate,\u00a0then this these problems can be solved by simply having apache act as a proxy to the subsonic service.<\/p>\n<h5>Configure Apache as a Web Proxy<\/h5>\n<p>First ensure that apache is installed and the proxy and proxy_http modules are enabled.<\/p>\n<pre>sudo apt-get install -y apache2\nsudo a2enmod proxy proxy_http<\/pre>\n<p>Then create the text file \/etc\/apache2\/conf-available\/subsonic.conf and copy the following content into the file:<\/p>\n<pre>SSLProxyEngine On\nProxyPreserveHost Off\nProxyRequests Off\n&lt;Location \/subsonic&gt;\n ProxyPass http:\/\/localhost:8080\/subsonic\n ProxyPassReverse http:\/\/localhost:8080\/subsonic\n&lt;\/Location&gt;<\/pre>\n<p>Finally, enable the proxy and reload the apache2 service.<\/p>\n<pre>sudo a2enconf subsonic\nsudo systemctl reload apache2<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Motivation Many people use music streaming services for the convenience and portability they can offer. However,\u00a0nearly all\u00a0of the ones I could find require the use of non-free software, use Digital Restrictions Management (DRM), and prevent you from sharing music with friends and family. All of these problems can be avoided by hosting your own music [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":458,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[5,11],"class_list":["post-194","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-sysadmin","tag-debian","tag-subsonic"],"_links":{"self":[{"href":"https:\/\/codemonkeyden.com\/index.php?rest_route=\/wp\/v2\/posts\/194","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codemonkeyden.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codemonkeyden.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codemonkeyden.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codemonkeyden.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=194"}],"version-history":[{"count":1,"href":"https:\/\/codemonkeyden.com\/index.php?rest_route=\/wp\/v2\/posts\/194\/revisions"}],"predecessor-version":[{"id":501,"href":"https:\/\/codemonkeyden.com\/index.php?rest_route=\/wp\/v2\/posts\/194\/revisions\/501"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/codemonkeyden.com\/index.php?rest_route=\/wp\/v2\/media\/458"}],"wp:attachment":[{"href":"https:\/\/codemonkeyden.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=194"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codemonkeyden.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=194"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codemonkeyden.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=194"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}