Nginx Transmission-daemon URL rewrite

teDDy picture teDDy · Mar 13, 2013 · Viewed 8.9k times · Source

I've been working around this configuration but to no avail. What I am trying to achieve is to mask my url from http://subdomain.domain.com:9091/transmission/web/ to http://subdomain.domain.com/tr/

This is what I've come on with so far

nginx default.conf

location /tr/ {
proxy_read_timeout 300;
proxy_pass_header X-Forwarded-Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:9091/transmission/web/;
proxy_redirect off;
}

The transmission web interface did show up but the css, jss and img is all 404. is there any workaround for this?

Thanks in advance.

Answer

Timmy Chiu picture Timmy Chiu · May 4, 2013

maybe a bit late...

upstream transmissionweb {
    server localhost:9091;
}

server {

    server_name     www.example.com;
    root            /var/www/www.example.com;

    access_log  /var/log/nginx/www.example.com.access.log;
    error_log   /var/log/nginx/www.example.com.error.log;


    location /transmission {
        proxy_pass          http://transmissionweb;
        proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
        proxy_redirect      off;
        proxy_buffering     off;
        proxy_set_header    Host            $host;
        proxy_set_header    X-Real-IP       $remote_addr;
    }

}