Setup Subsonic on IIS 7 (Windows Home Server 2011) - ARR 2.5

Tutorials, tips and tricks.

Moderator: moderators

Setup Subsonic on IIS 7 (Windows Home Server 2011) - ARR 2.5

Postby csobsidian » Thu Aug 11, 2011 1:31 am

Update: 2016-04-25 - Subsonic 6.0beta1

My previous tutorial utilized Tomcat's Jakarta ISAPI Redirect library to use IIS as the front end for Tomcat serving Subsonic. This implementation has one glaring problem when trying to stream transcoded files. Basically, the isapi_redirect.dll waits for the transcoded file to be completed prior to then serving it to the client. This makes for noticeable gaps between songs as each new song gets transcoded. Without finding a fix, I stumbled across a different technology to link IIS and Tomcat: Microsft's Application Request Router Extension. I have copied much of my previous tutorial here as there are many of the same steps and, as before, I've posted this here with the hope that it may serve as a central place with all the necessary information for someone to get Windows Home Server 2011 working with Subsonic with the following requirements:
- Make subsonic available on port 80.
- Make subsonic available at the root directory (no trailing folder structure in order to access subsonic).
- Leave the default IIS Web Sites intact.

In order to effectively help you all follow my lead we need to make some assumptions about the way my network is setup. For the purposes of this tutorial lets assume my network is setup with the following (replace the specifics as appropriate for your own network setup):
- I have a router with an external IP address of 50.51.52.53
- I have a router setup to use the dynamic dns of myWHS.dyndns.org which points to the above external address.
- My internal LAN uses the subnet 192.168.1.*
- My server's LAN address is 192.168.1.100.
- My server has a DNS service responsible for the domain home.com which is used to differentiate services on my LAN (subsonic.home.com, ftp.home.com, etc.).
- I have a client computer on my LAN that will have music/video streamed to it.

I will go into the detail of each step, but here's a quick overview of the entire process:

Download Programs
Install Java
Install Tomcat
Install Subsonic
Setup Subsonic for Transcoding
Setup a Subsonic website in IIS
Install and Configure the Application Request Router Extension in IIS


Download the Required Programs

The first step is to get all the binaries that are required to make a complete setup. The following is the complete list of what I downloaded and which versions I used in my installation. All versions are 64 bit since Windows Home Server 2011 only comes in the 64bit flavor. Some of these are pre-compiled for ease of use. Source code is available for those who want to use non-static libraries or just for fun.

Java Runtime Environment 6.26 (x64) - http://javadl.sun.com/webapps/download/ ... leId=49026
Tomcat 6.0.32 (x64) - http://mirrors.kahuki.com/apache/tomcat ... 6.0.32.exe
Subsonic 4.4 (.war) - http://sourceforge.net/projects/subsoni ... p/download
LAME 3.98.4 (x64) - http://www.rarewares.org/dancer/dancer.php?f=322
FFMpeg 2011-08-06 (x64 static) - http://ffmpeg.zeranoe.com/builds/win64/ ... -static.7z


Install Java

To get the ball rolling start with the Java installation since its required for Tomcat. I used the defaults for the entire installation which put the java files at "C:\Program Files\Java\jre6".


Install Tomcat

Next, perform the installation of Tomcat. I chose version 6 because I read elsewhere that there some issues with using version 7, though I don't recall what those conflicts are nor do I know if the most recent versions of 7 have rectified the issues. Just like the Java installation I used all the default settings. After the installation is complete verify that the Tomcat server is running by opening a browser on the server and pointing it to http://localhost:8080. You can then test that the server is accessible remotely by pointing the browser on the client computer to http://192.168.1.100:8080. The important one here is that subsonic comes up locally. If you want Tomcat to be accessible remotely then you can open port 8080 (or whatever port you used for Tomcat) for inbound access in Windows Firewall as I did, but for IIS to communicate with Tomcat this isn't necessary.


Install Subsonic

Open the subsonic zip archive and extract the subsonic.war file to "C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps". Restart Tomcat via the system tray on the server and then test the subsonic install by pointing your browser to "http://localhost:8080/subsonic/". As before you can test that this is available from a remote browser by pointing to "http://192.168.1.100:8080/subsonic/".

In order to make Subsonic the default application later in IIS, you will need to make it the default application in Tomcat. To do this, stop the Tomcat server. In the Tomcat webapps folder rename the "ROOT" application to "ROOT original". You could just delete it if you wanted to, but renaming it allows you to keep it archived for later should that be of value to you. Now rename the "subsonic" directory (which was created by Tomcat when it decompressed the subsonic.war file) as "ROOT" and rename the "subsonic.war" file as "ROOT.war". Restart the Tomcat server and you should now be able to see the Subsonic server at "http://localhost:8080" and "http://192.168.1.100:8080".


Setup Subsonic for Transcoding

Subsonic comes configured for transcoding by default. All that needs to be added is to give it the libraries to do the transcoding with. In order to do that we simply extract the LAME and FFMpeg zip archives to the "c:\subsonic\transcode" directory. Subsonic should automatically find them the next time you attempt to stream a file that isn't an mp3 or an flv.


Setup the Subsonic Website in IIS

Now we need a place to access the subsonic application in IIS. First, create an empty subsonic folder in the inet pub directory "C:\inetpub". In the Internet Information Services Manager, expand the tree and click on the Sites entry. Click Add Web Site. Call the new site Subsonic and enter a path of the empty subsonic folder that we just created ("C:\inetpub\subsonic"). For the binding I chose my IPv4 address of 192.168.1.100 and, per our requirements, left the default port of 80. Because this particular web site must respond when it gets a request for myWHS.dyndns.org this is what must be entered for the Fully Qualified Domain Name field. Click OK to create the new website.

Any number of virtual hosts can be used to point to this website. Per our requirements above we also want to be able to use subsonic.home.com on the LAN in order to access subsonic. To do this right click on the Subsonic website in the IIS manager and select Edit Bindings. A new window will appear where you will see the original binding made when you created the website. Click the Add button and you will get a form that looks identical to the bindings setting you used earlier. Select the same IP address (192.168.1.100) but this time add an FQDN of "subsonic.home.com".


Install and Configure the Application Request Router Extension in IIS

First, we need to install the Extension. In order to do that you need to open up your web browser on the server and point to the following url: "http://www.iis.net/download/ApplicationRequestRouting". The only way to install this extension, that I know of, is through this microsoft portal. Click on Install and bypass any warnings that IE may give you due to the default security settings. On the next page click Install Now. On the next popup click Run. This will start the Web Platform 3.0 which will facilitate the intallation of the Extension. Click Install and then I Accept to accept the installation of the required dependencies. When the installation is complete Click Finish and exit the Web Platform 3.0.

If your IIS Manager was open during the installation you will need to close the manager completely and then reopen it in order to see the new extension.

Now, lets setup the Routing so that our subsonic website utilizes the Tomcat as an application server. Click on the Server in the IIS Manager (denoted by the servers computer name) . Now double click on Application Request Routing Cache. Click Server Proxy Settings from the context menu on the right. Click the Enable checkbox and leave all other values as their defaults. Click the Apply item in the list on the right to save the settings.

Finally, all we have to do is setup a rule for our website to redirect to Tomcat. Select the Subsonic website in the pane on the left and then double-click URL Rewrite. Click the Add item on the list in the left column. Select an Inbound Blank Rule and click OK. Name our Rule something meaningful such as "Tomcat". Change the Using drop-down box to Wildcards and put a single asterisk ("*") in the Pattern text field. Change the Rewrite URL field to "http://localhost:8080/{R:0}" and click apply to save the rule.

Restart the IIS server and you should be able to see subsonic through the IIS server at the two addresses we defined as virtual hosts http://subsonic.home.com (internally) and http://myWHS.dyndns.org (internally and externally assuming the router is configured properly).


Known Issues

I have not yet found any issues. However, I would like to rewrite the ARR rules such that removing the default Tomcat application ROOT is not necessary. I am sure this can be accomplished through the creation of more specific Inbound and Outbound rules, but have not yet had the time to delve into it.

Updates for Subsonic 6.0beta1 (And probably earlier) - Added 2016-04-25

I have recently pushed my Subsonic version up to the 6.0beta1 and have had to update a few of the packages for this release. I am quite sure that these were required somewhere else along the line before now as I was still using Subsonic 4.7. I can confirm that I had the same problems in 5.3 as I did when trying to push to 6.0beta1 that were resolved after updating the following:

Java Runtime Environment 8u92 (x64) - http://www.oracle.com/technetwork/java/ ... 33155.html
Tomcat 8.0.33 (x64) - http://tomcat.apache.org/download-80.cgi#8.0.33
Subsonic 6.0beta1 (.war) - https://sourceforge.net/projects/subson ... p/download
Last edited by csobsidian on Mon Apr 25, 2016 6:21 pm, edited 1 time in total.
csobsidian
 
Posts: 22
Joined: Mon Aug 08, 2011 2:07 am

Awesome

Postby trickydick » Thu Aug 11, 2011 2:10 pm

I LOVE YOU....well not really. I have been looking for a way for this to work for so awhile. I love the fact microsoft has there own tool. I've already implemented it and currently don't see any issues. I did noticed there is a slight (1 to 2 sec) pause when playing a songs, but I think its still a transcode thing, and its is SO much better than the isapi_redirect transcoding length.

Thanks !!!
Tricky
User avatar
trickydick
 
Posts: 147
Joined: Wed Mar 30, 2011 12:43 am
Location: Sanford, North Carolina

Postby csobsidian » Thu Aug 11, 2011 2:19 pm

You're more than welcome and I absolutely agree that this seems to be a better solution that using the Jakarta ISAPI Redirect method that is so prevalent out there.

I woud also like to add that this should work with the default Subsonic installation as well since it is basically an HTTP proxy. That being said, have left the tutorial as a Tomcat installation since my access times with Tomcat vs. the default Jetty installation are about 5 times faster.

Best of luck all, and feel free to leave comments and suggestions for improvements!
csobsidian
 
Posts: 22
Joined: Mon Aug 08, 2011 2:07 am

Postby bushman4 » Thu Aug 11, 2011 3:34 pm

How do you handle the registration of your subsonic.org address? In this situation, subsonic is still going to register your custom domain name as http://outside.ip.address:8080/subsonic isn't it?

Glenn
Glenn Sullivan
Subsonic 5.2.1 (Standalone on Apache/Tomcat 6)
WHS 2003, Dual Core Athlon, 4 Gb RAM, 12 TB
50 regular Subsonic Users

Library as of 2016-03-21:
4,034 artists
16,595 albums
182,904 songs
4582.16 GB
21,558 hours
User avatar
bushman4
 
Posts: 867
Joined: Thu Dec 02, 2010 1:47 pm
Location: Massachusetts, USA

Postby csobsidian » Thu Aug 11, 2011 3:40 pm

I do not have a subsonic subdomain but if I understand correctly how Sindre sets this up, it is just like any other DNS setup out there. He has a record on his DNS server that will point to your external IP. Its then up to you to create a binding in IIS for the Subsonic website. Add the binding with the FQDN of your subsonic.org subdomain.

Using the example above if I had a subdoamin of csobsidian.subsonic.org I would add a binding with that Fully Qualified Domain Name to the Subsonic website created in the tutorial. Snce the Subsonic website in IIS is already configured to access Tomcat at the root level and over port 80 it should work with http://csobsidian.subsonic.org
csobsidian
 
Posts: 22
Joined: Mon Aug 08, 2011 2:07 am

Postby bushman4 » Thu Aug 11, 2011 3:49 pm

But that's not how it works. Sindre is not running a dns service, but rather a web redirect service.

(technically he is running both, but every custom domain name resolves to the same IP address, 66.49.215.227, but that is the same web server that hosts www.subsonic.org and performs the redirects for the rest of the custom domains)

For example, since I am running in Tomcat on port 8080 and have not replaced the root application with subsonic, my "straight" access info is:

Internal: http://internal.ip.address:8080/subsonic
External: http://external.ip.address:8080/subsonic

When subsonic registers my custom domain name, it looks up the external IP address of my machine, and then tells the subsonic.org web server to redirect (302 - Temporarily Unavailable/redirect message) to http://external.ip.address:8080/subsonic

With your setup I would want subsonic to register just http://subsonic.home.com, not http://external.ip.address:8080/subsonic.

I am going to look at the source code and find out how Subsonic communicates with it's "home" servers to register these redirects.

Glenn
Glenn Sullivan
Subsonic 5.2.1 (Standalone on Apache/Tomcat 6)
WHS 2003, Dual Core Athlon, 4 Gb RAM, 12 TB
50 regular Subsonic Users

Library as of 2016-03-21:
4,034 artists
16,595 albums
182,904 songs
4582.16 GB
21,558 hours
User avatar
bushman4
 
Posts: 867
Joined: Thu Dec 02, 2010 1:47 pm
Location: Massachusetts, USA

Postby csobsidian » Thu Aug 11, 2011 4:05 pm

I see the issue. As I have used my routers dynamic DNS capability for forever and a day I hadnt thought of this issue. I imagine that the redirect rule on Sindre's server appends the /subsonic/ folder and there probably isn't an easy solution to this. You could try adding your external IP address as a binding to the Subsonic website. This way external access (when the IP address is used) will default to the Subsonic server. You could then create a permanent redirect rule to push users from the /subsonic/ folder down to the root / folder.

I'm not sure but this might break compatibility with remote web access via the WHS 2011 launchpad (not sure about this as I havent used it yet and external access may be via the subdomain.homeserver.com address and not external IP).

Thoughts?
csobsidian
 
Posts: 22
Joined: Mon Aug 08, 2011 2:07 am

Domain Name

Postby trickydick » Thu Aug 11, 2011 4:52 pm

I have a registered sub domain name with sindre as well and I don't use it only becuse my external IP is dynamic. This is what I do:

Go to namecheap and purchase a domain name of you liking...its like 9 bucks a years if not cheaper (with free SSL)

In NameCheap, turn on dynamic DNS for that domain, then download the Dynamic DNS Changer application (provided by namecheap) that will run on your server. It will up date your external IP automatically to namecheap for that particular domain

Then setup your binding in IIS to point to that same domain.

Done.

Here is my only concern: The subdomain is somwhere written in the java code of subsonic to give your subsdomain URL, its just a matter of replacing that with a 'request.getRequestURI()' or something of that nature in JAVA. Another way is to modify the JSP page to complete rewrite the URL

Change sharesettings.jsp
Code: Select all
<a href="${model.shareBaseUrl}${share.name}" target="_blank">${share.name}</a>


with:
Code: Select all
<a href="http://www.yourdomainname.com/share${share.name}" target="_blank">${share.name}</a>


It seems to work. The createshare portion still displays the subdomian though. I figured that could be changed to.

You'll have to change the externalplayer.jsp code:
Code: Select all
<meta name="og:image" content="http://${model.redirectFrom}.subsonic.org${coverArtUrl}"/>


to

Code: Select all
<meta name="og:image" content="http://www.yourdomainname.com${coverArtUrl}"/>
Tricky
User avatar
trickydick
 
Posts: 147
Joined: Wed Mar 30, 2011 12:43 am
Location: Sanford, North Carolina

Re: Setup Subsonic on IIS 7 (Windows Home Server 2011) - ARR

Postby trickydick » Thu Aug 18, 2011 4:13 am

How many people run subsonic on Windows Home Server 2011? I currently am running Windows Server 2008 R2. But I am very interestd in home server edition, so I purchased a very cheap OEM license and should be getting it soon. But my curiuosity goes further. I want to be able to do more with my media. I've already downloaded a trial version of it and have loaded in Hyper-V and saw some options that can make it my new "workstation". anyway, Has anyone ever tried developing an subsonic addin for WHS?
Tricky
User avatar
trickydick
 
Posts: 147
Joined: Wed Mar 30, 2011 12:43 am
Location: Sanford, North Carolina

Re: Setup Subsonic on IIS 7 (Windows Home Server 2011) - ARR

Postby Robandcathy » Thu Sep 15, 2011 1:26 am

A add in would be great, almost to surreal one program that installs everything you need to make it work. On to my question...wait a million thanks for the post on how to do this on whs 2011, hell I'd even donate a few bucks just for you time to share. sorry back on topic, I actually have several questions :|
1. Looked your steps over and over again and I am stuck... after putting and renaming the root folder, and file, also restarting apache, I try internet explorar and still end up on apache web page. I went as far as to delete the folder I renamed original still same problem. Everythihg else has been on key till this part.
2. I do not use a microsoft account, rather I use a go daddy account, I have a ssl, and the binding done in IIS 7, can I use my go daddy accout somehow to link it to subsonic, eg. android app subsonic goes to go daddy then redirects to my server. I guess I could figure this out later but if you have any insight would be grateful.
3. If new versions of subsonic, apache, or any other software become available, will we have to redo all the steps with the new files? or is there a easy way to upgrade.... as you know homeserver blocks almost all internet explorar downloads.
Thanks Rob
EDIT: I guess I could add a link on my home page to go directly to the specific port, Like I did for my home automation software.
Another question since I do not have it working, does it use windows log in, or a subsonic one or both? or does subsonic even offer user control.
Pain is a state of mind
Weak minded people feel pain
User avatar
Robandcathy
 
Posts: 64
Joined: Mon Sep 12, 2011 12:31 am

Re: Setup Subsonic on IIS 7 (Windows Home Server 2011) - ARR

Postby BKKKPewsey » Thu Sep 15, 2011 2:11 am

You may be interested in this thread http://forum.subsonic.org/forum/viewtopic.php?f=8&t=7322
If it ever happens?
With regard to the log-in users log-in to SS. You can see this in action via the demo just log out and you will see the normal log in page.
Everyone is entitled to be stupid, Image but some abuse the privilege!

Due to the confusion from too many genres of music, we have decided to put both country music and rap music into the genre of Crap music.
User avatar
BKKKPewsey
 
Posts: 2080
Joined: Mon May 23, 2011 12:16 pm
Location: United Kingdom

Re: Setup Subsonic on IIS 7 (Windows Home Server 2011) - ARR

Postby Robandcathy » Thu Sep 15, 2011 2:56 am

Thanks that was a good start to my questions, anyone else have any input?
Pain is a state of mind
Weak minded people feel pain
User avatar
Robandcathy
 
Posts: 64
Joined: Mon Sep 12, 2011 12:31 am

Re: Setup Subsonic on IIS 7 (Windows Home Server 2011) - ARR

Postby Robandcathy » Thu Sep 15, 2011 9:05 pm

Edit Now I can see the subsonic log in using my ip address but it still goes to tomcat if I use localhost.
Pain is a state of mind
Weak minded people feel pain
User avatar
Robandcathy
 
Posts: 64
Joined: Mon Sep 12, 2011 12:31 am

Re: Setup Subsonic on IIS 7 (Windows Home Server 2011) - ARR

Postby trickydick » Tue Sep 27, 2011 3:38 am

Godaddy also has an area in its control panel where u can change it to point to ur home external address..
go to http://www.whatismyip.com to find ur ip

note: if ur ip is not static u may have to regularly check ur ip and change Godaddy's settings

Then login to ur router and add a port forwarder for ports 80 and 443 to ur servers internal address

note: some internet service providers don't allow port 80 out, so u may have to get a business account. $$$$ :!:

Jetty users: install subsonic and set it to use 80
Tomcat only user: make sure you tomcat config is set use port 80. And subsonic.war is renamed to ROOT.war. Restart service.

IIS front-end users: make sure tomcat is not bound to 80. Keep it default (8080) if possible. Install iis redirect through the IIS 7 web installer. If hosting multiple websites on port 80 u must set the bindings to ur domain name. Then follow the guide in this forum to setup the jsp redirect.
Tricky
User avatar
trickydick
 
Posts: 147
Joined: Wed Mar 30, 2011 12:43 am
Location: Sanford, North Carolina

Re: Setup Subsonic on IIS 7 (Windows Home Server 2011) - ARR

Postby trickydick » Tue Sep 27, 2011 3:45 am

I host over 10 websites using home server 2011....to include the homeserver website over https. It's not hard to do, just setup ur bindings for each site. If u need full step by step detailed instructions, let me know and ill post it.
Tricky
User avatar
trickydick
 
Posts: 147
Joined: Wed Mar 30, 2011 12:43 am
Location: Sanford, North Carolina

Next

Return to Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest