0

我一直在解决这个配置,但无济于事。我想要实现的是将我的网址从http://subdomain.domain.com:9091/transmission/web/屏蔽到http://subdomain.domain.com/tr/

这就是我到目前为止所做的

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;
}

传输网络界面确实出现了,但css、jss和img都是404。有什么解决方法吗?

提前致谢。

4

2 回答 2

4

可能有点晚了……

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;
    }

}
于 2013-05-04T20:01:04.093 回答
3

我使用以下配置代理传输。请注意“位置/torrent/” - 我将传输中的默认“rpc-url”设置从“/transmission/”更改为“/torrent/”。

这适用于 Ubuntu 12.04.2 LTS 下的 nginx/1.2.7 和传输 2.51。

upstream transmission {
    server 127.0.0.1:9091;
    keepalive 4;
}

server {
    listen 80;

    server_name localhost;

    location /torrent/ {
        proxy_http_version 1.1;
        proxy_set_header Connection "";
        proxy_pass_header X-Transmission-Session-Id;

        location /torrent/rpc {
            proxy_pass http://transmission;
        }

        location /torrent/web/ {
            proxy_pass http://transmission;
        }

        location /torrent/upload {
            proxy_pass http://transmission;
        }

        location /torrent/web/style/ {
            alias /usr/share/transmission/web/style/;
        }

        location /torrent/web/javascript/ {
            alias /usr/share/transmission/web/javascript/;
        }

        location /torrent/web/images/ {
            alias /usr/share/transmission/web/images/;
        }
    }
}
于 2013-03-13T19:52:42.593 回答