In this article I'll describe hot to set up transmission daemon and use it with nginx.
Install package transmission-cli, which has CLI tools, daemon and web client included. By default transmission runs as standalone daemon on port 9091. That's the port on which I set proxy forwarding in nginx.conf.
Quick setup:
- to start it with systemd, create file /etc/systemd/system/transmission.service.d/user.conf with following content:
[Service] User=krisko- then start the daemon (systemctl start transmission), it should create config file in users' home directory: /home/krisko/.config/transmission-daemon/settings.json
NOTE: always remember to shut down daemon, before editing this file, otherwise changes you made will be discarted!
In this file edit and set following directives:
"download-dir": "/mnt/transmission" "incomplete-dir": "/mnt/transmission" "rpc-authentication-required": true "rpc-bind-address": "127.0.0.1" "rpc-enabled": true "rpc-password": "your password (will be hashed with daemon)" "rpc-port": 9091 "rpc-url": "/transmission/" "rpc-username": "krisko" "rpc-whitelist": "127.0.0.1" "rpc-whitelist-enabled": trueNow start the daemon, you should be able to connect with URI 127.0.0.1:9091/transmission.
Setting up nginx:
Install package nginx and edit config file /etc/nginx/nginx.conf (this is not my full nginx.conf file, just the lines for proxy forwarding to transmission):
#transmission configuration location /transmission/ { proxy_pass_header X-Transmission-Session-Id; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://127.0.0.1:9091/transmission/web/; } # Also Transmission specific location /rpc { proxy_pass http://127.0.0.1:9091/transmission/rpc; }The last step is creating link to transmission web directory in nginx root directory (/srv/http):
/srv/http/transmission -> /usr/share/transmission/webWith this configuration, you should be able to connect to transmission via <nginx socket>/transmission.
Hi, thanks for your article, could you be more specific on the last step? "Create link to..." because I'm not aware of this.
ReplyDeleteHi, this link is because on Archlinux transmission is installed in /usr/share/transmission/web directory and document root for nginx is in /srv/http. So to be able to access transmission you can either create link or copy /usr/share/transmission/web to /srv/http/transmission...
ReplyDeleteIn my case I have created link:
ln -s /usr/share/transmission/web /srv/http/transmission
Thanks for your answer, I figure out my issue with another ln -s /usr/share/transmission/web /path/transmission/web and all static files where not anymore in "404" status.
ReplyDeletesame probem here, nginx does not follow symbolic links in default settings
ReplyDeleteGoodpost, the /rpc part helped me a lot. Thanks !
ReplyDeleteThanks for the instructions. I rarely expect nginx instructions to be copy paste but this just worked! Thanks again.
ReplyDeleteHi Thanks, this worked for me as well, however I'm not getting the authentication prompt (user/pass) when I go to the web interface, did I miss something?
ReplyDeleteHello,
Deletein case you are using proxy before transmission, the connection IP is 127.0.0.1,
which is enabled in the rpc-whitelist. You can either set rpc-whitelist-enabled to false, or remove 127.0.0.1 from the whitelist. Afterwards you should get a password prompt.
421: Misdirected RequestTransmission received your request, but the hostname was unrecognized.To fix this, choose one of the following options:Enable password authentication, then any hostname is allowed.Add the hostname you want to use to the whitelist in settings.If you're editing settings.json, see the 'rpc-host-whitelist' and 'rpc-host-whitelist-enabled' entries.This requirement has been added to help prevent DNS Rebinding attacks. Error apears.
ReplyDelete