How can I host a server on my own PC and make it accessible from the internet without renting a server or cloud hosting?
Posted by NoTutor4458@reddit | learnprogramming | View on Reddit | 14 comments
I know my PC needs to run 24/7, but I have a spare PC and also I just want to learn how to do this
Acrobatic-Ice-5877@reddit
The simplest safest way is to use Tailscale. This will allow you to access it but it won’t be exposed over the internet. It is a free VPN software built on top of WireGuard, which is an open source VPN software that is highly secure and well known.
I do not recommend using WireGuard because it is very difficult to access a home network on a residential network due to the way ISP companies route traffic. You will constantly fight against the configuration of it and have days where it does and does not work.
TailScale solves this really well and they just updated their free tier to allow up to 6 devices on the same network. I use it to remotely develop when I am away from home. I have a self hosted GitLab that I can access from anywhere so long as the computer is on, connected to the internet, and Tailscale is running.
Munguskiller@reddit
Can also vouch for this - currently also hosting backend on my old laptop, however I'm also running a k3s on it and tunneling through cloudflare to a domain i bought for pennies. I recommend it very much if you need to access the backend from anywhere else.
firmretention@reddit
Can vouch for this, especially Wire Guard being flaky. Tailscale just works.
hyper4saken@reddit
It depends how & want to access If you have domain and you have some selfhosted web apps you can use cloudflare tunnel.
Or alternative like RDP or ssh use tailscale
povlhp@reddit
Free Cloudflare account and Cloudflared. Unless you have a public IP
teotwawki42@reddit
If you actually want publicly accessible with no authentication then cloudflared is probably the easiest to set up and has a lot of security controls available for free. You may want to learn a little about docker or podman. However, if you want it only accessible by you set it up with cloudflared as an "application" and you can add oauth in front of it and login using your google account or another email address. Tailscale is another good option. Both of these options are designed to only allow the traffic to hit the destination internal server and protects from ddos, gives you free TLS certificates for the relevant subdomains, and can be disabled instantly even if you can't access your server.
povlhp@reddit
That is why I suggested. And always use passkeys for login.
Ill-Significance4975@reddit
You also need a publically-routable IP, and a way through your home's router.
The hard part is getting a way to resolve a DNS name.... your-site.whatever.... to that laptop (or something that forwards to it).
Back in the day we used to use a dynamic DNS service that would update a domain name periodically as your ISP allocated you a new public IP via DHCP, but these days with carrier-grade NAT that may not work. Hardly ever works on mobile, at least in my area.
Not sure I'd really call this "programming".... maybe try r/networking
pak9rabid@reddit
Most wired ISPs (in the US at least) still hand out public IP addresses.
AardvarkIll6079@reddit
Most ISPs prohibit this. And will terminate your service if caught.
Novel-Mail5840@reddit
If it is only for you you may try set up a VPN, but your sistem will be more vulnerable. I suggest you not to do such things.
Powerful-Antelope259@reddit
Set up a web server, give it a port and expose that port to the Internet (Port Forwarding). But be careful: your port will be constantly under attack by automatic malware, scanning the Internet for vulnerable servers. You will have to implement some security measures, or you will get serious problems.
DirtAndGrass@reddit
It's not too hard, but there are some good reasons not to - security risks - probably against your isp's tos - if you have a non static ip, you'll have to get a service that remaps your address to your ip - some residential isp's limit upstream spees
Other than that, it is a matter of - forwarding your ports on your router - checking your local machine for firewall settings that block the ports you need - installing/configuring the server software
scandii@reddit
what you're looking for is called port forwarding.
however, exposing something to the internet is inherently risky. consider security (there's no way you have any idea how to secure a service if you're asking about port forwarding) before proceeding with what you want to do.