A
A
Alf19902020-01-13 02:03:13
Nginx
Alf1990, 2020-01-13 02:03:13

Does anyone know how to do port forwarding with NGINX?

Hello! Installed nginx
And decided to forward subdomains to different machines with different ports, started with a torrent:
tor.site.ru made a subdomain, sent record A to its IP.
In nginx for tor.site.ru I wrote:

server {
listen 80;
listen [::]:80;
root /var/www/tor.site.ru/html;
index index.html index.htm index.nginx-debian.html;
server_name tor.stie.ru www.tor.site.ru;
location / {
try_files $uri $uri/ =404;

location / {
            proxy_pass $scheme://192.168.1.12:9091;
            proxy_redirect     off;
            proxy_set_header   Host             $host;
            proxy_set_header   X-Real-IP        $remote_addr;
            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
}

}
}

Everything is wonderful access from the outside appeared to this machine.
Then I tried to do the same for VPN, but unfortunately the response did not go. Tell me what's the matter? dripped dripped and did not find a solution to the problem. Here they write that it is possible through iptables, but I also did not find an example.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
vreitech, 2020-01-13
@Alf1990

through nginx, you can only forward (proxy) http/https traffic and its derivatives (ws/wss/spdy). vpn is not one of them.

V
Vladislav, 2020-01-13
@ghostiam

You do not need nginx, but iptables port forwarding, but with it you cannot limit by domain name, since the domain is not transferred in the connection request.
https://losst.ru/probros-portov-iptables-v-linux
https://serverfault.com/questions/140622/how-can-i...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question