Self-Hosting Behind a NAT

But… why??

Wait a minute, we have the cloud now! Why should I bother about self-hosting at all?

Okay, you’ve convinced me, I’m behind a NAT and I want your magic solution!

Setup a Reverse Proxy

http { upstream backend-home { server 0.0.0.0:17899; } server { listen 80 default_server; listen [::]:80 default_server; server_name _; return 301 https://$host$request_uri; location / { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_pass_request_headers on; proxy_pass http://backend-home; } } }

Some Considerations

[Unit] Description=SSH Tunnel After=network.target [Service] Restart=always RestartSec=20 User=[YOURLAPTOPUSER] ExecStart=/usr/bin/ssh -N -g -R 17899:localhost:8080 yourusername@[YOURONLINEIP] [Install] WantedBy=multi-user.target
sudo systemctl enable sshtunnel sudo systemctl start sshtunnel

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store