简体   繁体   中英

configure nginx to redirect to another server

I have nginx installed on a Raspberry Pi and this works okay. What I want to do is redirect traffic for a particular port to another server, and have that traffic come back through the Raspberry Pi. I've got the following in my default sites config;

server {
    listen 9001;
    server_name piweb;

    location /transmission {
        proxy_pass http://pyrate:9001/$uri$is_args$args;
        proxy_set_header Host $host:$server_port;
    }
}

But that doesn't work obviously. Is this even possible, or am I barking up the wrong tree?

your configuration seems almost OK, is http://pyrate:9001 accessible from your pi ? did you try with wget or similar tools ? You should remove the $uri$is_args$args - it passes automatically. Note that it'll search /transmission/[request] on remote server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM