nginx问题请教下,如何端口转发到虚拟目录

查看 43|回复 2
作者:比特鼻   
就是把端口转发成虚拟目录来访问
比如说内网用 transmission 来BT下载,需要IP+端口来使用, http://192.168.31.x:9091 但一堆端口不好记,怎样可以转发成 http://192.168.31.x/bt/ 这样虚拟目录来访问?
当然还有调试各种源码程序,也不想记一堆端口,用公网 IP + 虚拟目录,代替端口实现
网上没找到专门讲这样,找了类似来抄,发现不对,请问哪里出错,应该怎么改?
[ol]location ^~ /bt/ {
        client_max_body_size 1024m;
        proxy_http_version 1.1;
        proxy_set_header Upgrade         $http_upgrade;
        proxy_set_header Connection      "Upgrade";
        proxy_set_header Host            $http_host;
        proxy_set_header X-Real-IP       $remote_addr;
        proxy_set_header X-Forward-For   $proxy_add_x_forwarded_for;
        proxy_set_header X-Forward-Proto $scheme;
        proxy_redirect off;
        proxy_pass http://127.0.0.1:9091;
}
[/ol]复制代码
location ^~/ttyd {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header Host $http_host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Range $http_range;
        proxy_set_header If-Range $http_if_range;
    proxy_redirect off;
    proxy_pass http://127.0.0.1:7681;
    # the max size of file to upload
    client_max_body_size 20000m;
}

端口, 虚拟目录, 公网

thaizxj   
问chatgpt
xiaxiapi   
:7681是server节点上端口。想什么。
您需要登录后才可以回帖 登录 | 立即注册

返回顶部