Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Subscribe to our newsletter

Advertise on LowEndTalk.com

Latest LowEndBox Offers

    Serving Something From Home, Via Proxy (or Something)
    New on LowEndTalk? Please read our 'Community Rules' by clicking on it in the right menu!

    Serving Something From Home, Via Proxy (or Something)

    I have an application that only runs on Windows, but I don't use it all that often and don't want to pay for a Windows VPS to run it. It presents itself as a web app.

    I'm wondering if I could host it at home (where I have Windows) and proxy the traffic. So something like this:

    • home computer runs Windows and the app
    • from my secret island retreat, one of my fembots opens her laptop and goes to myvps.example.com which I host on a Linux LEB
    • going to myvps.example.com transparently passes all traffic to my home on some nonstandard port and my home router sends it (via port forwarding, etc.) to the Windows box, which then responds and it my fembot sees it in her browser and has no idea I'm using Windows at all (except for a bit of latency)

    The LEB would have to be periodically updated with my residential Comcast IP, or find it via dyndns.

    Can I do something like this purely with nginx upstream or do I need something fancier, and if so...what?

    Thanked by 2netomx rokok

    For LET support, please visit the interim support desk.

    Comments

    • Run a VM and use a VPN ?

    • ALinuxNinjaALinuxNinja Member
      edited January 2016

      @raindog308 said:
      I have an application that only runs on Windows, but I don't use it all that often and don't want to pay for a Windows VPS to run it. It presents itself as a web app.

      I'm wondering if I could host it at home (where I have Windows) and proxy the traffic. So something like this:

      • home computer runs Windows and the app
      • from my secret island retreat, one of my fembots opens her laptop and goes to myvps.example.com which I host on a Linux LEB
      • going to myvps.example.com transparently passes all traffic to my home on some nonstandard port and my home router sends it (via port forwarding, etc.) to the Windows box, which then responds and it my fembot sees it in her browser and has no idea I'm using Windows at all (except for a bit of latency)

      The LEB would have to be periodically updated with my residential Comcast IP, or find it via dyndns.

      Can I do something like this purely with nginx upstream or do I need something fancier, and if so...what?

      Just connect from the Windows box to Linux VPS, NGINX can then use the internal VPN ip as a backend.

      IP will not need to be static on local connection.

      Thanked by 2netomx doghouch

      Devops Consultant | GitHub

    • perennateperennate Member, Provider
      edited January 2016

      Don't see any reason why nginx wouldn't work. Just statically specify domain in the nginx config, and use dynamic DNS as you said. Windows box can listen on the nonstandard port, or if your router supports port forwarding from different incoming/target port then that works too.

      Edit: actually I'm not sure if nginx assumes the domain has static IP or not.

      Edit2: see http://serverfault.com/questions/240476/how-to-force-nginx-to-resolve-dns-of-a-dynamic-hostname-everytime-when-doing-p (the second answer, or https://forum.nginx.org/read.php?2,215830,215832#msg-215832) -- tl;dr nginx only resolves IP on reload with typical config, but different config can make nginx resolve it again

    • raindog308 said: Tagged:

      need-to-trim-my-pr0n-collection

      Thanked by 2netomx rokok

      Thanked by 2raindog308 netomx

      Go give Vultr(referral) a try. | GNU/Linux http://debian.org

    • I do not think you need a dyndns, since you need a vpn anyway.

      Configure a vpn service in your linux vm, and ideally setup a DNS server; configure the windows machine to connect to the linux VM, and the nginx is talking to a machine in the internal network.

      However, this setup is inherently fragile since your home network is not reliable as the DC.

      My site, powered by Netlify and Let's Encrypt.

    • AnthonySmithAnthonySmith Top Provider

      just run haproxy on a linux box with simple forwarding (I can write you a config file if you want/need it).

      keep a copy of the haproxy.cfg on your windows box and write a quick batch file that runs on a scheduled task in windows to update the ip in the haproxy.cfg and upload it to your server.

      on the linux box write a 'watch' script that updates the haproxy script if the ip changes.

      to get rid of scripts if that sounds messy install rsync on the server and use delta copy which has a gui and scheduling to update your haproxy file.

      the issue with any suggestion even with dyndns is that is that you will get the very odd occasion between updates that your site wont work.

      I know you will have thought about this but I will ask as you did not mention it, cant you use wine to run the app on linux?

      Had enough of the scams on lowendbox, lowendtalk is now being infiltrated by corruption so I have chosen to make an low end exit #lexit for now - you can find me HERE

    • dnydns service / domain for your home IP if its dynamic and a nginx reverse proxy on a linux vps pointing to that dyndns domain. You can also restrict the desired port on your home firewall to let only your linux nginx reverse proxy connect to it.

      Hey there... nothing to see here

    • JonchunJonchun Member, Provider
      edited January 2016

      raindog308 said: Can I do something like this purely with nginx upstream or do I need something fancier, and if so...what?

      Have you considered something like this?

      server {
        listen 80;
        server_name example.com;
        location / {
          resolver 8.8.8.8;
          set $backend "dyndnshere";
          proxy_pass http://$backend;
          proxy_set_header Host            www.example.com;
          proxy_set_header X-Forwarded-For $remote_addr;
        }
      }
      

      Beats having to be connected to a VPN or doing some complicated setup IMO.

      Edit: Sample code updated thanks to @perennate

      Thanked by 1Shade
    • perennateperennate Member, Provider

      @Jonchun that's what I was just saying above, AFAIK if you use proxy_pass with domain then the domain will only be resolved when nginx first starts or is reloaded. Another configuration is needed to make it resolve the domain again periodically -- https://forum.nginx.org/read.php?2,215830,215832#msg-215832

    • agonyztagonyzt Member
      edited January 2016

      You could also just open a SSH tunnel from your Windows machine to your VPS and setup remote port forwarding. Configure nginx on your VPS to reverse proxy the port on localhost et voilà! No need to open any port on your home network and your server doesn't need to know your home IP.

      edit: You can even bypass the nginx part if you enable SSH gateway in sshd, but I don't recommend it as you won't be able to bind any port below 1024 by default anyway.

    • You could take the Nginx or HAProxy route with a nice bash script in cron to detect an IP change from your dyndns that bash script could then restart either of the servers..

      Problem solved ;)

    • netomxnetomx Member, Moderator

      Use a VPN with no routes from the Windows mahcine, and on the NGINX have the VPN server, and then proxy it?

    • JonchunJonchun Member, Provider

      @perennate said:
      Jonchun that's what I was just saying above, AFAIK if you use proxy_pass with domain then the domain will only be resolved when nginx first starts or is reloaded. Another configuration is needed to make it resolve the domain again periodically -- https://forum.nginx.org/read.php?2,215830,215832#msg-215832

      Ah I missed your post. I've updated the original post to reflect the change.

    • GM2015GM2015 Member
      edited January 2016

      That sounds great. I've been tunneling most of my network connections on this crap laptop through my raspi since the wifi always dies on my laptop for some reason, but it works with making a socks proxy through the pi.

      !/bin/bash

      ssh -C2qTnN -D portnumber [email protected] -f

      Cygwin could probably be used to make a localhost socks proxy.

      http://www.howtogeek.com/howto/41560/how-to-get-ssh-command-line-access-to-windows-7-using-cygwin/

      Damn thing works even between server 08, debian 8 and 12.

      agonyzt said: You could also just open a SSH tunnel from your Windows machine to your VPS and setup remote port forwarding. Configure nginx on your VPS to reverse proxy the port on localhost et voilà! No need to open any port on your home network and your server doesn't need to know your home IP.

      edit: You can even bypass the nginx part if you enable SSH gateway in sshd, but I don't recommend it as you won't be able to bind any port below 1024 by default anyway.

      Go give Vultr(referral) a try. | GNU/Linux http://debian.org

    • GM2015 said: Cygwin could probably be used to make a localhost socks proxy.

      Or putty, even more simple ;)

      Thanked by 1GM2015
    • Softether server on the windows computer, client on the VPS. If you want softether will even handle the dynamic DNS.

      Use internal IP on nginx or similar proxy

    • farsighterfarsighter Member
      edited January 2016

      You can do that easily (and free) using services like PageKite and Ngrok which offer reliable localhost tunneling. No need of VPS in the middle :)

      Both offer Windows clients (I've only used on Linux VMs though).

      PageKite is much more generous with free users than Ngrok and should definitely be the choice for the long term (if you're not planning to pay) - but I find Ngrok good for easy quick start, just to get the feeling (some usage is even possible without registration ) .Ngrok provides ugly subdomains though.

      I used PageKite in past under heavy NAT and it worked flawlessly. You can even link a CNAME record to your subdomain with them and use with your own domain.

      It should be noted that PageKite free service is donations-based.

      https://pagekite.net/

      https://ngrok.com/

    • emgemg Member

      Why use an intermediate VPS? Why not go directly to the non-standard port on the home router? I have used freedns.afraid.org for dynamic DNS for many years.

    • @emg said:
      Why use an intermediate VPS? Why not go directly to the non-standard port on the home router? I have used freedns.afraid.org for dynamic DNS for many years.

      that's what I'm using for sensors on my home network. works great

    Sign In or Register to comment.