Setup the Transmission Web Interface Behind an Apache Reverse Proxy and SSL

• Updated December 19, 2017


By default, the transmission-daemon service uses its own web server and runs on port 9091. Assuming the service is running and the proper firewall holes have been made, the Transmission web interface can be accessed by going to http://transmission.example.com:9091. While remembering to append port 9091 is not difficult, it would be much cleaner to just go to http://transmission.example.com.

To accomplish this, one option would be to change the rpc-port parameter in /var/lib/transmission/.config/transmission/settings.json to port 80 instead of port 9091. By default, making this change will not work. Port 80 is a restricted port and requires the service to be running as root or to have the appropriate CAP_NET_BIND_SERVICE capability.

A second option is to put the transmission-daemon service behind an Apache Reverse Proxy. Why would you want to put the transmission-daemon service behind an Apache Reverse Proxy?

First, it will allow you to navigate to a simpler URL such as http://torrents.example.com instead of http://transmission.example.com:9091. Why did I use torrents.example.com instead of transmission.example.com? If the transmission-daemon service and the Apache service are running on different servers you will have to use different hostnames. However, if the transmission-daemon service and the Apache service are running on the same server you can continue to use transmission.example.com.

Second, with the transmission-daemon service behind Apache, you can easily setup SSL to encrypt all of the traffic between you and the Transmission web interface (this is not encrypting actual bittorrent traffic). This is even more useful if you have the transmission-daemon service setup for authentication; usernames and passwords should never be sent in plain text.

So, how can you set this up?

The following steps are specific to Fedora and Enterprise Linux based distributions, but they can be easily adapted to work on other Linux distributions.

First and foremost, if you are using SELinux, and you should be, be sure to turn on the following SELinux boolean, otherwise nothing will work:

setsebool httpd_can_network_connect on

Install the Apache web server:

yum install -y httpd

Remember to change torrents.example.com and transmission.example.com in the examples below to match whatever domain names you are using.

If you don’t care about encrypting the traffic between you and the Transmission web interface, create /etc/httpd/conf.d/torrents.conf with the following contents:

NameVirtualHost *:80

<VirtualHost *:80>
    ServerAdmin admin@example.com
    ServerName torrents.example.com
    ErrorLog logs/torrents.example.com-error_log
    CustomLog logs/torrents.example.com-access_log common

    ProxyPass / http://transmission.example.com:9091/
    ProxyPassReverse / http://transmission.example.com:9091/
</VirtualHost>

If you do care about encrypting the traffic between you and the Transmission web interface, install the mod_ssl package:

yum install -y mod_ssl

Then, create /etc/httpd/conf.d/torrents.conf with the following contents:

NameVirtualHost *:80
NameVirtualHost *:443

<VirtualHost *:80>
    ServerAdmin admin@example.com
    ServerName torrents.example.com
    ErrorLog logs/torrents.example.com-error_log
    CustomLog logs/torrents.example.com-access_log common

    RewriteEngine On

    RewriteCond %{SERVER_PORT} =80
    RewriteRule ^/(.*)$ https://%{SERVER_NAME}:443/$1 [R,L]
</VirtualHost>

<VirtualHost *:443>
    ServerAdmin admin@example.com
    ServerName torrents.example.com
    ErrorLog logs/torrents.example.com-ssl_error_log
    CustomLog logs/torrents.example.com-ssl_access_log common

    SSLEngine On
    SSLCertificateFile "/etc/pki/tls/certs/server.crt"
    SSLCertificateKeyFile "/etc/pki/tls/private/server.key"

    ProxyPass / http://transmission.example.com:9091/
    ProxyPassReverse / http://transmission.example.com:9091/
</VirtualHost>

In either case, restart the httpd service:

service httpd restart

If you are running iptables, firewalld, or ufw, be sure to open port 80 and port 443 if you are using SSL on the server where Apache is running.

You should now be able to navigate to http://torrents.example.com (this will always redirect to HTTPS if you are using the SSL config above) or https://torrents.example.com to access the Transmission web interface.

If you found this post useful and would like to help support this site - and get something for yourself - sign up for any of the services listed below through the provided links.

The following links are part of affiliate programs, and I will receive a referral payment from any of the services you sign-up for.

  • Get Faster Shipping: About to order some stuff on Amazon but want to get more value out of the money you would normally pay for shipping? Sign-up for a free, 30-day trial of Amazon Prime to get free two-day shipping, access to thousands of movies and TV shows, and more.
  • Start Investing Now: Looking to start investing some of your saved income? Get started by opening an account with Webull, where upon sign-up and opening a brokerage account with an initial deposit of $100 or more you will receive free stock(s). The promotions are always changing, so be sure to click the link to see the latest.

Thanks for reading and take care.