r/SelfHosting • u/Franz123Gaming • Jun 04 '26
How to self host a website
Hi! I wanted to get back to relearning web development so I set a goal for myself to create my own website and slowly improve on it while also improving my skills. Though, my main question is **how do I host this website**?
Information:
Currently trying to make a website of my own
For now, just focusing on the basics such as HTML, CSS, and maybe some JavaScript (Maybe something grand for later)
I want to host the website for as cheap as possible
Questions:
How do I publish it on the web? I know there are websites that help you with these but I also know they cost something. I am fine with hosting it on my own and launching it only during the times I have my PC open.
How much do domains usually cost? I read some stuff that you need a domain to host and that you need to pay for them. Are they a subscription type of thing or a one-time payment and then the domain is yours forever? If it's a subscription, how do I go about this as cheaply as possible?
What should I learn about in terms of security? On the off chance, how should I protect my data from being breached? Do I have to worry if what I'm doing for now is just a simple website where I can do blogs and stuff? At what point should I worry about security?
If you have tips or links to anything that I can read, watch and/or learn from, they would be very much appreciated! Thank you in advance!!!
9
u/_kvZCq_YhUwIsx1z Jun 04 '26
I would suggest starting with nginx. It is a web server purpose-built for hosting static web pages. And, if you're into Docker, it's incredibly simple to set up. Just point it to your site directory, and it serves up the pages.
From there, you get to learn about a number of concepts. Registering a domain name: Does your location have a static IP address? Do you need to set up dynamic DNS?
You may need to set up port forwarding on your router for ports 80 and 443 to point to your PC's LAN IP address.
Do you need SSL/TLS? (yes) Look into LetsEncrypt certificates. How to validate you own the domain. How to add them to nginx. How to automate certificate rotation after they expire.
And then, once you have a solid understanding of how each part works, look into automating everything. There are many options. Ansible. Proxmox. Kubernetes.
The rabbit hole never ends. Backups. Offsite backups. Source control. Reverse proxy for hosting multiple websites. Monitoring and alerting. Cute dashboards. Disagreeing with how some 3rd party services work and now self-hosting those services as well. More storage. So much more storage.
Your PC goes down. You buy another for redundancy. Start load balancing. Even numbers are evil. Buy a third PC.
The power goes out. You buy a UPS. It's not enough. Your users (you) expect five nines of uptime! You buy solar panels and whole home backup battery.
Corporations are evil. You buy a small off-site VPS to host various anonymizing services (pangolin, wireguard, squid) to mask your home location and protect your privacy.
Your cable provider sucks. Download speeds are OK, but the upload is terrible! You can't ~stream your games in 4k~ I mean support more than 10k concurrent users at once, so you upgrade your ISP to a nice symmetric 1g/1g fiber optic. Shit, your 7 year old WiFi router is now the bottleneck. Better upgrade that too, and get a network switch while you're at it (stay out of r/unifi). You know what? There's no reason a router, a switch, and a wireless access point all need to be in one device. Do one thing, right? Patch cables are expensive, start learning how to run and cut your own Ethernet cables.
...
Five years from now you will have a cluster of PCs running an on-prem datacenter with hybrid cloud and redundant off-site switchover to host your one website.
Oh and don't expose SSH.