Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is it possible to host my Transmission or uTorrent web interface on my web server? They have a local network web interface, and I don't want to port forward... Can I somehow configure it to it to log into my server and host the interface there?

share|improve this question

migrated from stackoverflow.com Aug 9 '11 at 8:04

This question came from our site for professional and enthusiast programmers.

2  
You could set up a reverse proxy over an SSH tunnel... if you really wanted to... –  cdhowie Aug 9 '11 at 3:35
    
How would I go about that? –  tekknolagi Aug 9 '11 at 3:57
1  
It was kind of a joke. But you could do it by using the -R argument to ssh to reverse-forward a port to your torrent client's web interface, if your hosting company allows -R. Then you'd set up a reverse proxy in Apache over the forwarded port. –  cdhowie Aug 9 '11 at 4:08
1  
@tekknolagi, you don't get rep for upvoted comments...sorry. Only questions. –  tombull89 Aug 9 '11 at 8:33
1  
@cdhowie, you might want to consider posting this suggestion as an answer, since it seems to have been helpful to the OP. –  DMA57361 Aug 9 '11 at 8:58

2 Answers 2

up vote 0 down vote accepted

Port forwarding would have served as an appropriate answer... It works flawlessly.

share|improve this answer

Ok, since all of you asked for a kludge, here it is.

You can set it up so you can access the web interface through your web hosting account, with the following restrictions:

  • The actual interface will still be hosted by your torrent client, but you will be able to reach it via your website.
  • Your host must allow remote port forwards (ssh -R). Most VPS hosts will allow this; shared hosting will probably not.
  • Your host must allow you to configure Apache with the ProxyPass directive, which means that you must have write access to some part of the Apache config (not .htaccess files) and your host must load (or allow you to load) mod_proxy into Apache.
  • Your host should allow the installation of an SSH public key so that you can survive an ssh disconnection without needing to enter a password to reconnect.

Here's the basic idea. Let's call the port that your web interface is served on locally port L. Pick some random port in the range 49152-65535 and call it S; this is the port that the server will be listening on.

Create an SSH key for this setup, and do not encrypt the private key with a password (hit enter when prompted). Use ssh-keygen for this. (ssh-keygen -f $KEY_OUTPUT_PATH -- pick some file like $HOME/torrentproxy.key for the output path.) Then install the public key on the server: ssh-copy-id -i $KEY_OUTPUT_PATH.pub user@yourwebhost.

Create a shell script torrent-ssh-proxy.sh with these contents:

#!/bin/sh

while true; do
    # Replace S and L with the ports chosen above.
    # Replace $KEY_OUTPUT_PATH with the path to your SSH private key.
    ssh -i $KEY_OUTPUT_PATH -R S:localhost:L user@yourwebhost

    echo 'Disconnected from server.'
    sleep 5
done

When you run this, you should get a shell prompt from the server with no password entry required; this is good. Leave this script running.

(At this point, you might verify that the remote host is in fact listening on port S by running netstat -tnlp | grep :S in the server shell.)

Now we need to configure Apache. You just need to add this to your Apache config (it won't work from .htaccess files):

ProxyPass /torrentweb http://localhost:S/

Again, replace S with the listening port chosen. Restart Apache.

If this all worked, when you go to http://yourwebsite.example.com/torrentweb you should see your torrent client's web interface.

Note that you can run the ssh client on a different box from the web host; just adjust "localhost" in the ssh line in the script to match the IP address or hostname of the machine running the torrent web interface.


Regarding loading mod_proxy, this is how the module is loaded on Debian:

LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so

The path to mod_proxy.so is likely to be different depending on your distribution's way of arranging package contents in the filesystem.

share|improve this answer
    
Is the Apache config /etc/httpd/conf/httpd.conf ? –  tekknolagi Aug 9 '11 at 20:42
    
Depending on your distro, yes, it could very well be that. –  cdhowie Aug 9 '11 at 20:44
    
Shoot. Is there an alternative file that could have the same effect? On WebFaction (my provider) I cannot edit that file. Could I place the line somewhere else? –  tekknolagi Aug 9 '11 at 20:45
1  
I've added a short paragraph on the loading of mod_proxy. –  cdhowie Aug 10 '11 at 19:09
1  
If you are on the hosting plan then this probably won't work (but it might). There is no bulletproof way to determine your distro. –  cdhowie Aug 10 '11 at 22:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.