7 ms·
Host a static website the HN way: 1. Buy the cheapest most unsustainable VPS ipv4 deal out there. 2. Make A record and WWW record and point domain to your new
by ehonda 7y ago
Host a static website the HN way:
1. Buy the cheapest most unsustainable VPS ipv4 deal out there.
2. Make A record and WWW record and point domain to your new fangled server.
3. Configure server:
apt-get install nginx goaccess
cd website
cp * /var/www/html
Yearly maintenance required: apt-get update, apt-get upgrade
reboot
View traffic stats: goaccess -f /var/log/nginx/access.log
- dragonwriter 7y ago> Buy the cheapest most unsustainable VPS ipv4 deal out there. [...] > Yearly maintenance required: Well, presumably, find the new cheapest, most unsustainable VPS ipv4 deal, the previous one not having been sustained.
- nsporillo 7y agoThe last time I tried to maintain a personal VPS I was using it for a Jenkins build server so users could obtain the latest artifacts of some open source programs I work on. That burned me after it got exploited using a Jenkins RCE and a bitcoin miner was installed on the VPS. Also, the cheapest VPS you can find likely won't ever achieve the level of scale your static website in S3 could achieve. In the rare event you get a lot of web traffic, you're only hosed if AWS is hosed.
- capableweb 7y agoYou gotta receive a ton of traffic for Nginx to stop serving static files. I'm pretty sure most of the static websites today could survive on a lite Nginx vps with minimal tuning. Also, i rather have my server go down than to receive a larger bill from aws, but that all depends on your use case obviously
- nsporillo 7y agoYeah this is probably true, I've never actually had a nginx instance be overwhelmed myself. I just don't know how much I trust VPS providers that aren't charging a premium $5+/month to deliver quality reliable performance. The best part of S3 + Route53 is your costs are basically constant. $.50 a month for the hosted zone and then you pay pennies on the dollar for GBs of data transfer. In theory your bill could balloon if you had a hefty static website or some big files left public in your buckets and someone constantly downloaded it.
- eli 7y agoS3 isn’t actually that great at serving a ton of traffic without a CDN in front of it
- Tilian 7y agoIt's amazing how truly unreliable ultra-cheap VPS providers can be. You're lucky if you even get an upfront notice before they decommission hardware you are relying on, or the entire company just disappears overnight. Usually you get what you pay for.
- heavyset_go 7y agoIt costs like $2 for the lowest tier VPS through OVH, and they aren't going to disappear overnight.
- nerdkid93 7y agoGoogle Cloud gives you 1 free f1-micro compute instance. Coupled with a CDN like Cloudflare or Netlify, it should be beefy enough for a static site.
- superkuh 7y agoI've used the same openvz instance with my ultra-cheap VPS providerfor as long as google's "Cloud" platform has effectively existed. It's been extremely solid with almost instant support over IRC. I've paid $5/mo for this the last decade. Sounds like you just made some bad choices. Big companies are only marginally less likely to disapear services than small companies are to disappear.
- cc-d 7y agoIs this company named RN? You've described my experience exactly.
- iudqnolq 7y agoSerious question: how much more maintenance is required? Could I get away with unattended-upgrades and nginx+wsgi+PostgreSQL? I ask because actual servers seem like dark magic to me so I want to try to build a product with them, but I can't find anywhere if it's possible to run a reasonably secure server without years of studying.
- jjice 7y agoI felt the same was last year before I had ever deployed a server publicly. It's really not that bad for small things. I run Nginx and some docker containers and proxy to those docker containers for certain subdomains. Now that I know how to do it, I moved from AWS to DO and the new setup was probably 20-30min to get everything set up, including Let's Encrypt.
- ehonda 7y agoyou can change the ssh port and use a ssh key instead of a password. Don't worry about a firewall or fail2ban. That's about all. Also run everything from root. Repeat above steps once vps provider goes out of business (as someone else also pointed out)
- e12e 7y ago> you can change the ssh port and use a ssh key instead of a password. I'd advice against changing the ssh port - I don't think the (small) inconvenience is worth the (tiny) benefit to obscurity. I would always recommend turning off password authentication for ssh, though. (along with disabling direct root login via ssh, but root-with-key-only is now the default - and if you already enforce key based login, it's a bit hard to come up with a real-world scenario where requiring su/sudo is much help for such a simple setup). I would probably amend your list to include unattended-upgrades (regular, automated security-related updates - but I guess that's starting to be standard, now?). You will probably need an ssl cert, possibly from let's-encrypt. At that point, with only sshd and nginx listening to the network - avenues of compromise would be kernel exploit (rare), sshd exploit (rare) or ngnix exploit (rare) - compromise via apt or let's-encrypt (should also be unlikely). Now, if the site is dynamic, there's likely to be a few bugs in the application, and some kind of compromise seems more likely.
- manigandham 7y agoYou can also just get a micro instance from the major cloud providers. Just as cheap, and more reliable and usable with all the cloud tooling.
- scarface74 7y agoBut then you have to manage the instance. Once you set everything up with S3, your deployment is literally. aws S3 cp $your-local-directory S3://your-bucket
- manigandham 7y agoThat's out of context. I was responding to OP getting a cheap VPS provider. If you want a cheap server then it's better to just get a tiny instance from a major cloud instead. Most also have free tiers.
- scarface74 7y agoThe top of his post was “Host a static website the HN way” It would be overkill for a static website.
- manigandham 7y agoThen reply to their post instead?
- thinkxl 7y ago> Host a static website the HN way Gatekeeping alert! Fortunately, there is more than one way to do things. I've been in HN for a while now and I don't do any of this. I was doing it when I wanted to learn, but now I need to get a project launched without any burden so I deploy it to ZEIT Now which is not the same as OP, but you get the idea.
- tastroder 7y agoHow is that "without any burden"? That's paying somebody else to take that burden for you, buying into their non-standard tooling, and hoping that they outlast whatever project you are hosting.
- thinkxl 7y agoYou pay for convenience. Someone else takes care of the server. I pay them $5 per month for the site/app I pay $15 for the database in other place and I charge +$150/hour while I work in something else instead of dealing with the server. That's without any burden.
- scarface74 7y agoYou realize he was being sarcastic right?
- thinkxl 7y agoNope. It's really hard to distinguish these days!
- veeti 7y agoReplace nginx with Caddy for zero config HTTPS.
- mholt 7y agoAnd even bring your config with you: https://github.com/caddyserver/nginx-adapter https://github.com/caddyserver/nginx-adapter
- htfy96 7y agoI would wait for Caddy 2 at this point, for I found 1.0 doesn't work very well when your site gets complicated - many directives conflict with each other. Fortunately it seems that most of these are solved in 2.0.
- mholt 7y agoDon't wait, start using it now while we're in beta so we can fix problems before they affect everyone!
- mr_toad 7y agoFor extra work add a let’s encrypt client, configure Nginx to do ssl, and set up automatic renewal.
- joking 7y agothere are literal dozens of sites who offer free static site hosting, from github pages to firebase hosting, why advantage you get using a VM?
- amerkhalid 7y agoServer side stats instead of Google Analytics is big one, imo.
- tastroder 7y agoA machine I can actually use, portability. I have enough servers, adding nginx and certbot to one isn't hard. Adding instances and load balancing isn't either should it be warranted. The "serverless" approach is the new one and thus the one that should seek justification.
- scarface74 7y agoIf you’re hosting static content, are you really worried about the “lock in” boogeyman?
- pm90 7y ago> I have enough servers, adding nginx and certbot to one isn't hard. I think this is key. If you have resources that are already serving things, the marginal cost of serving something else is low. For a typical person not running servers for personal services, the upfront cost does not seem justified, when its so easy (and cheap) to setup and use the alternatives.
- ummonk 7y agoAnd watch it go down from the load when it gets linked to on HN.
- 9HZZRfNlpR 7y agoStatic site? You can serve insane amount if static content with cheap vps box. Are people now only using so called serverless tech and forgotten how it works underneath all the buzz words? 5 dollar digitalocean box can serve double the HN traffic and more.
- cowsandmilk 7y agoThe described cloud front configuration would be less than $5/month. How? As you point out, the cheap VPS box can serve insane amounts of traffic, so AWS doesn’t even need hardware equating to that box to host your content.
- joeyspn 7y agoI used to do this 15 years ago, but it's 2020... rock solid hosting for small projects has been free for a long time and takes 0 maintenance time. Plus making it to the top of HN won't kill your site. A true hacker way in 2020 would be using IPFS or Dat... =)
- nathell 7y agoI've been renting a $3/mo ARM C1 server from Scaleway for 5 years now (a physical microserver) and doing exactly this. It handles being on HN frontpage without a hiccup. I'm very happy.