How does nginx reverse proxy only to the secondary directory of the site?

the path to bt on my nas is olddomain.myqnapcloud.com:60080/rutorrent/
. The original configuration is as follows, so that when I visit it, it is newdomain.com/rutorrent/. But I want to remove the rutorrent at the end

is to visit newdomain.com and reverse proxy to olddomain.myqnapcloud.com:60080/rutorrent/
for advice. Thank you

.
server
        {
                listen 80;
                server_name newdomain.com;

                if ($http_user_agent ~* (baiduspider|360spider|haosouspider|googlebot|soso|bing|sogou|yahoo|sohu-search|yodao|YoudaoBot|robozilla|msnbot|MJ12bot|NHN|Twiceler)) {
                return  403;
                }

                location / {
                sub_filter olddomain.myqnapcloud.com:60080 newdomain.com;
                sub_filter_once off;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header Referer http://olddomain.myqnapcloud.com:60080;
                proxy_set_header Host olddomain.myqnapcloud.com:60080;
                proxy_pass http://olddomain.myqnapcloud.com:60080;
                proxy_set_header Accept-Encoding "";
                }
}

server
        {
                listen 80;
                server_name new.abc.io;

                if ($http_user_agent ~* (baiduspider|360spider|haosouspider|googlebot|soso|bing|sogou|yahoo|sohu-search|yodao|YoudaoBot|robozilla|msnbot|MJ12bot|NHN|Twiceler)) {
                return  403;
                }

                location / {
                sub_filter olddomain.myqnapcloud.com:60080/rutorrent/ new.abc.io;
                sub_filter_once off;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header Referer http://olddomain.myqnapcloud.com:60080/rutorrent/;
                proxy_set_header Host olddomain.myqnapcloud.com:60080;-sharp
                proxy_pass http://olddomain.myqnapcloud.com:60080/rutorrent/;
                proxy_set_header Accept-Encoding "";
                }
}

that's fine. ~

Menu