Answer the question
In order to leave comments, you need to log in
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;
}
}
}
Answer the question
In order to leave comments, you need to log in
through nginx, you can only forward (proxy) http/https traffic and its derivatives (ws/wss/spdy). vpn is not one of them.
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 questionAsk a Question
731 491 924 answers to any question