13 ms·
Static site hosting hurdles
- free652 4y agoCloudflare has free hosting for static content. there are some limits, but my sites are tiny.
- eschatology 4y agoThe limits are actually pretty darn extreme for CF Pages — no bandwidth limits, 20000 files, and 500 deployments per day. It's mind-boggling for me to read the comment section with people paying (and recommending!) anything above 0$/mo for static page hosting, because most likely GitHub / CF Pages can handle more requests than that and requires zero maintenance.
- ThinkBeat 4y agoapt install apache2 mkdir /var/www/your_domain cp /home/a/website /var/www/your_domain
- tomcam 4y agoSobering, eye-opening, and encouraging in one swell foop. I am bookmarking & backing this page up because it coalesces many many issues that have been plaguing me with static site generation. Well done.
- akerl_ 4y agoIt felt odd to see a doc this comprehensive on static site hosting with no mention of AWS S3/Cloudfront, given how easy it is to push content to an S3 bucket (either manually or via the CI pipeline of your choosing) and then serve it up either direct-from-S3 or via Cloudfront. But then it turns out that this is actually pushing folks towards some new paradigm of static cached HTTP responses instead of files. It pitches this as an attempt to “standardize the hosting side of static sites”, which doesn’t pass muster for me. We’ve already standardized the hosting side of static sites by using the file system. Shifting to a new storage format besides “HTML on disk” doesn’t unify anything, nor does it seem desirable to have fewer options for serving content.
- danuker 4y agoS3 is not competitive. Here: https://neocities.org/supporter https://neocities.org/supporter
- akerl_ 4y agoCompetitive by what metric? My site lives more or less entirely within the AWS free tier. I think my total AWS bill is around $20/mo, and 80% of that is for the stupid number of domain names I’m hosting zones for.
- Something1234 4y agoQuick question: Why wouldn't I use my free tier registrar DNS? Are there really that man DNS queries serviced cause you pay based off the number of responses? Especially if they are stupid domains.
- akerl_ 4y agoAs far as I can tell, there’s only 2 upsides I’m getting by using AWS as a registrar: 1. I’m lazy, and I already manage a bunch of other stuff in AWS, so it’s convenient for me to have the domains in the same place 2. For some of the domains, I’m serving records that point to other AWS resources (like Cloudfront and S3). AWS’s Route53 has clever helper features when you’re pointing records at other AWS services). Otherwise, you’re right that there’s plenty of registrars that’ll do perfectly solid DNS
- lukewiwa 4y agoFor me my static sites are small enough that it all falls within the free tier and I can deploy everything using the CDK.
- numtel 4y agoIf you're ok with using Cloudflare's free plan for your DNS, you can stop paying for each hosted zone.
- 4y ago
- jacooper 4y agoI think these issues only exist if you decided to host the site yourself, I did and currently optimizing Caddy settings, but kawipiko surely seems interesting, however I use caddy as a reverse proxy too, so I can't switch. If you just to chose to use Cloudflare Pages you will get the best settings, and performance by default, its effortless. I self host because Cloudflare already has enough control on the internet, it serves more than 20% of the web! https://w3techs.com/technologies/history_overview/web_server https://w3techs.com/technologies/history_overview/web_server
- fallat 4y agoOk so let's make a UI that asks for your credit card and which host you want... This has nothing to do with the web servers IMO. Even if we give people the configuration done there will still be other issues. It has to be as easy as pressing one "go online" button, really.
- nathants 4y agodon’t forget to add cloudflare workers + r2. the best parts of lambda and s3, without the egress billing.
- yawnxyz 4y agoI've never even worked with lambda and s3, and CF workers and R2 took like 20 minutes for me to learn and set up. I don't know how they made it so incredibly easy to learn and get going compared to AWS, but every time I try to figure out how to do AWS I get confused and get put off.
- nathants 4y agoaws has too many knobs, presumably to satisfy the union of the needs of all the enterprise customers. that said, lambda+s3+dynamodb+ec2 are pretty good once you tape over all the knobs that aren't needed. i work with them like this[1]. these days i build on aws and r2. aws for the nuts and bolts, r2 for high bandwidth egress. it's a perfect match. 1. https://github.com/nathants/libaws https://github.com/nathants/libaws
- DanHulton 4y agoJust because there are a lot of options, doesn't make something complicated. Hosting a static site - arguably the simplest kind of site - could be easily done with any of the options listed and derided at the start of the article.
- forrestthewoods 4y agoYeah I went with Netlify for my static site because I have zero desire to ever been an IT admin. I do skip the static generator part and go with artisinally hand crafted HTML/CSS/JS instead. It’s radically simpler and ultimately better imho.
- hum3hum3 4y agoI used to use Amazon but something broke somewhere and I haven' fixed it. Netlify was very low effort on my part. However I really like the idea of this approach as it helps feed into owning your own data. So I may have another go using this.
- pwdisswordfish9 4y agoHow do you get your content into Netlify? They push the CI/CD angle pretty hard (sometimes to the exclusion of other things; e.g. bugs in the CLI that break things if you aren't on their expected/happy path) and the fetishization of GitHub-integrated CI/CD leads to stuff that is about as complex as the traditional undesirable IT overhead.
- forrestthewoods 4y agoMy static website is in a private GitHub repo. I simply push to that. Because my site is not statically generated there’s no real complexity here? When I’m working on it locally I simply open a .html file from my local drive in a browser. When I’m done I push to GitHub and Netlify updates in seconds.
- hoppyhoppy2 4y agoIf that's a concern, you can choose to deploy your site from a .zip file uploaded straight to Netlify
- bandrami 4y agoNot mentioning S3 here seems weird
- furyofantares 4y ago> the cloud operator, given that all of the above choices are self-hosted (or at least require some system administration skills), would immediately go for a hosted solution like CloudFlare Pages, Netlify, Vercel, or one of the source code hosting sites that also have static site hosting solutions like SourceHut pages or GitHub pages; i think of myself as a graybeard (in the article's parlance; i find the term exclusionary) and i use cloudflare in front of github pages. every year i've spent as this craft has seen me accumulate more than a year's worth of new things i'd like to program or learn, 30 years in the list is very long. spending my time and energy doing IT for a static web site is a major waste
- pdimitar 4y agoYeah exactly. As I am saying to another person in this comment section here: it's not about if I can do do the thing in HTML+CSS and upload it. Of course I can. But it's extremely low in my list of priorities. I prefer to write a Markdown article, run just one command, preview locally and if happy, do a `git push` -- the rest is being handled for me. Way too many people wear their meaningless manual busywork as a badge of honor. No time or patience for that crap. These are the things that the computers were invented to do. Let them, they do it better. You are a creative force, use your energy on creative endeavours, not on pointless BS. I, like you, have no less than 500 things in my mental (and partially written) backlog to "check one day". I want to eventually get to that point, not to write HTML.
- ibn_khaldun 4y agoThis is a very good white paper.
- Linda703 4y ago[dead]
- habibur 4y agoThere's also HTTP HEAD requests, and "304 Not Changed" that you need to take care of. This is what makes static site download look instantaneous. There's more of such optimizations. With all these I find it better to stick with old Apache or similar service for speed, rather than a simpler service that only takes care of GET.
- deleted 4y ago[deleted]
- ciprian_craciun 4y agoIf one has the pre-generated response for a "simple" `GET` request (one that doesn't use conditional headers, ranges, or other advanced HTTP features), then a server could easily generate proper responses (based on that simple response) to any such complex requests. For example: * `HEAD` is just taking the `GET` response and replying with just the headers (no body); * if the pre-generated `GET` response contains an `ETag` header, then the server could easily handle an `If-Match` and `If-None-Match`; (else, such a static server implementation could fallback for each resource with a temporary generated `ETag` that is obtained by hashing the path of the resource and some random token generated when the server was started;) * if the pre-generated `GET` response contains a `Last-Modified` header, then the server could easily handle `If-Modifiend-Since` and other related conditional requests; (else, the server could just consider that all resources have the `Last-Modified` header equal to the moment the server was started;) * if the client requests a range of that resource, the server could easily respond with a slice of the stored `GET` response; In fact, what I describe here is nothing out of the ordinary, all caching proxies do exactly this: they store the "simple" `GET` response, and then they derive all other responses based on that.
- joelberman 4y agoLast month I paid $1 for route53, 12 cents for S3. and am hosting my https site which I create with publii. Works fine. Took a little time to set up, but now it is just a button push to update the site. Great for my personal blog and phtot gallery.
- gonzo41 4y agoI pay 80 cents for the same as you. I only have 1 domain on route53. But I do also have a Lambda and API_GW mixed in there that get's infrequent to zero use.
- chubot 4y agoUh what's wrong with shared hosting? I use Dreamhost but there are dozens of others. It costs less than $10/month and I've used it since 2009. I think the industry (or part of a generation of programmers) somehow collectively forgot that it exists. I don't see any mention of it in the article -- it solves the problem exactly. It easily serves and survives all the spikes from Hacker News that my site gets. Shared hosting is a Linux box with a web server that someone ELSE manages. You get an SSH login, and you can use git and rsync. It's associated with PHP hosting, but it is perfect for static sites. http://www.oilshell.org/blog/2021/12/backlog-assess.html#appendix-shell-is-fast http://www.oilshell.org/blog/2021/12/backlog-assess.html#app... Answer to the HN question: What's the fastest way to get a page on the web? https://news.ycombinator.com/item?id=29254006 https://news.ycombinator.com/item?id=29254006 FWIW I also have a Linux VPS with nginx and a HTTPS certificate, but it's a pain. I much prefer using shared hosting for things I want to be reliable.
- adriangrigore 4y agoShell is what I use to generate my sites also https://mkws.sh https://mkws.sh! Very simple, very eficient!
- alberth 4y agoDreamhost is hugely underrated. Their custom panel with deep integrations are phenomenal for side projects or small businesses. In under a minute you can have your web server, SSL cert, database and more all setup and working - and you don’t have to manage any of it. I wish more companies offered their level of managed services. (If anyone knows of others, I’d like to hear who)
- dragontamer 4y agoIs there anything really wrong with a CPanel host with FTP upload? Namecheap, Dreamhost, GoDaddy even (well maybe not them lol). There are a billion shared hosts everywhere and CPanel really isn't hard to use for HTTPS enabling or getting FTP locations to work with. ------ Bonus points: shove a random .php file in there and it probably will work if you need just a little bit of dynamic content.
- dragontamer 4y agoI'm very confused by this entire post. No mention of neocities or shared/managed hosts (Namecheap or even GoDaddy?) I mean, I know we nerds look down upon GoDaddy and other such sites, but it's cheaper than setting up a VPS and good enough for any static site.
- decasia 4y agoI guess everyone has their own solution to this. Here's mine: - Write some static html and one stylesheet - Pay DigitalOcean for the cheap plan - Run nginx + letsencrypt - Apply linux security updates promptly - Occasionally pay to renew the domain So yeah, that does take a little bit of (very simple) systems administration skills, and it's a recurring commitment. But there is no such thing as a successful but unmaintained web site. Even if you don't have to maintain the infrastructure, you have to maintain the content. So I don't mind the occasional maintenance tasks. They keep me in touch with linux systems administration in a good way. It's cool to write your own web server software, I guess. But serving static html is pretty much a solved problem. I felt like the OP was inventing problems with it that don't really exist in practice.
- bitexploder 4y agoLet the updates run automatically. Put certbot on a cron. Ride it until ubuntu LTS I am on dies. So easy. :)
- doodlesdev 4y agoYou can also use Caddy in place of NGINX and let it handle Lets Encrypt for you :)
- bitexploder 4y agoI hadn’t really touched caddy in a while. For a static site I may just do that if my cron script ever falls over. I was also feeling hipster and wanted to play with Justine’s redbean. It is sort of appealing to just drop a binary off somewhere and be done with it, but like `apt install nginx` is also trivial as a user :)
- coder543 4y agoI used to do something similar, but DigitalOcean App Platform's $0/month "starter" plan[0] hosts a static site for even less effort. When I was self-hosting on a DigitalOcean droplet, I was using Caddy instead of nginx, which handled letsencrypt for me, so that was nice. [0]: https://www.digitalocean.com/pricing/app-platform https://www.digitalocean.com/pricing/app-platform
- mymythisisthis 4y agoI'd be nice to run a self-hosted site from a home server. Currently paying a third party for a static site, but space is so limited. Storage space isn't that expensive, until you have to pay monthly for it. Mostly just want to host my own pictures. Would really like a hands on workshop to learn to do it (how to get a static IP, setup everything correctly, how to use https).
- esperent 4y agoI switched from Vercel static site hosting, because I recently read an article here about how it's usually more economical to scale vertically instead of horizontally (i.e. use one big server for everything). Even though I'm only running a few services, I did the math and realized it's absolutely true. I can fit everything I'm running onto one DigitalOcean droplet behind Cloudflare for $24/month + an extra 25gb block storage for $2.5/month + $5/month for backblaze backups. Everything being: a bunch of static sites, Keycloak Auth, Rocket.Chat, Odoo business management software, Nginx Proxy Manager, Outline (self hosted Notion), Docker, Portainer, Cockpit, Listmonk. Static sites are free actually, besides storage. You can just add a location directive pointing to the folder in Nginx Proxy Manager and it'll serve the files for you. The biggest memory hog is Keycloak which is a Java app so it uses 700mb of ram. But in any case I have set up an entire small business software suite with a hosting cost of $31.5 and I can host unlimited static sites with no additional cost.
- laundermaf 4y agoThe other problem is that one goes down, they all go down. A static website has absolutely no reason to go down.
- ipaddr 4y agoBut often does because the host, external lib or cloudfaire has an issue.
- pdimitar 4y agoHardly a problem for a personal blog. I host a few things on my baremetal server at home. When I get kernel updates (2-3 times a month) the Docker container with the Pi-Hole is rebooted and for 30 secs DNS resolution doesn't work in our home network. I probably can fix that by changing the script to do blue-green deployment (only stop the container after a new one has been brought up) but it honestly isn't such a problem. If it bothers me I will likely spend no more than one hour to fix it.
- esperent 4y agoIt's all containerized. The only reason for it to go down is if DO or CF have an outage. Which is rare enough that it's not an issue for me.
- longrod 4y agoThe article is right in that setting up a server for any kind of hosting is not a simple task. There are no "good defaults" or "templates" easily embeddable/extendible for your specific use-case.
- bsuvc 4y agoGitHub Pages works well for me. https://pages.github.com/ https://pages.github.com/
- preseinger 4y agofasthttp doesn't implement HTTP/1 correctly, and doesn't implement HTTP/2 at all. It's not an appropriate choice for a general purpose tool or library. The code is also not correctly formatted. Strong negative signals.
- ciprian_craciun 4y ago> fasthttp doesn't implement HTTP/1 correctly Could you point to an issue describe such an improper behavior? > doesn't implement HTTP/2 at all Or HTTP/3; and most likely it won't implement HTTP/4 (after the HTTP/3 fashion dies out). There is an issue about this on `fasthttp`'s repository: <https://github.com/valyala/fasthttp/issues/144 https://github.com/valyala/fasthttp/issues/144> And I'll quote here what I've said there: > Having experimented in my kawipiko static server based on fasthttp with both HTTP/2 (based on the Go's implementation) and HTTP/3 (based on an experimental available library), I continue to believe that perhaps HTTP/2 and HTTP/3 is a job for some other component of the infrastructure, be it a CDN or even a local HTTP router / load-balancer such as HAProxy. Thus if one needs HTTP/2 or HTTP/3 in order to reap their performance benefits, then using a CDN that actually supports these is the best approach.
- idealmedtech 4y agoQuick but important note: for those who don't know already, Volution sells a square space-esque managed site builder with hosting, which means this post does have a minor conflict of interest (although these days I guess it's called content marketing). Haven't seen it mentioned yet in the comments.
- ciprian_craciun 4y ago[the author here] Where do I sell a "square space-esque managed site builder with hosting"? I need to get on some of that revenue! :) :) :) Under the name of "volution" I own the following: * volution.ro -- where this article was posted, which contains no products or hosting services, or even advertising to anything; (it does contain links to my GitHub projects, all of which are purely open-source; and links to my business site bellow and to another project I'm working on but which has nothing to do with hosting;) * volutico.eu -- which is a "under construction" page for my consulting firm; * github.com/volution -- where there are a few more polished open-source projects, including <https://github.com/volution/kawipiko https://github.com/volution/kawipiko> which is an open-source implementation of the ideas described in this article; So, either there this is a case of mistaken identity, or please point me in the right direction. (Searching on the internet for `volution` it does yield some companies which have a similar name, but those have nothing in common with me.) :)
- idealmedtech 4y agoAh, my apologies! This is the one I thought you were associated with; one letter makes a big difference: https://www.volusion.com/ https://www.volusion.com/ I figured it was one of those "founder-has-a-blog-with-very-similar-name-to-capture-new-users" situations. Nothing wrong with it, just something I feel it's important to be aware of. Sorry for the mixup!
- graton 4y agoI am currently using GitLab to do my static site hosting for free using their pages feature. And I get to use my own domain name and have SSL/https support automatically.
- lunias 4y agoIt costs me about 1 dollar a month (never more than 2 dollars) to host my website. I use: - VuePress - Amazon S3 - Amazon Certificate Manager - Amazon CloudFront - Amazon Route53 For deployment: - CircleCI - s3deploy It's a super simple (and cheap) setup. Just push a commit and the site gets updated.
- terminal_d 4y agoHi, what do you use circleCI for here?
- Syeposxr 4y agoWhat's wrong with Netlify or Surge.sh?
- throwaway892238 4y agoWhy would you ever host a static site yourself? There is nothing special about it, it's just text. Use any of the dozen different free static site hosters. If you're just trying to learn web server tech, then do it all yourself, but jump through the hoops too; don't use a tool that does it all for you, that defeats the purpose.
- schemescape 4y agoAre there any static hosts that provide HTTP logs? I know it’s not perfect, but I want to have some sort of analytics without trackers.
- adriangrigore 4y agoTake a look at how I do analytics https://s.mkws.sh https://s.mkws.sh! Simple log parsing with awk!
- ciprian_craciun 4y agoYou could just use GoatCounter <https://www.goatcounter.com/ https://www.goatcounter.com/>; it's simple to deploy it yourself (it's open-source), but it's also free to use it hosted, and it seems to be quite privacy friendly (if one could call a web analytics solution as such). If you are already using CloudFlare, they have a (free and) simple enough web analytics solution. (They say they are also privacy friendly, but given it's not open-source you can't check.) As with static hosts that provide HTTP logs, perhaps they are, but certainly they won't be for free, as log shipping (from the edge where most hosted solutions cache things to the aggregator) and then storing those isn't quite that cheap...
- schemescape 4y agoI forgot to specify my goal when asking about HTTP logs: I want to get some basic analytics without adding anything to my HTML. I love Goat Counter, but I still have to add a tracker (a privacy friendly one, but a tracker nonetheless). Cloudflare looks like it might actually provide what I'm looking for, but the price is a bit too high for my low traffic hobby projects (looks like it starts at $20/month). I could just host my site on a VPS for cheaper than that (although I'd prefer some sort of managed/hosted offering under $10/month, if I can find one).
- ciprian_craciun 4y agoNo, with Cloudflare you can use for free the "web analytics" product; you can even use it for any site, not only those hosted at CloudFlare. (Perhaps what you've seen is the "cache analytics" or "traffic analytics" which indeed are payed.) (I use it "web analytics" on my own site thus I can confirm that it's free.)
- rozenmd 4y agoWith wrangler2 (https://github.com/cloudflare/wrangler2 https://github.com/cloudflare/wrangler2) you can deploy a static site to Cloudflare for free (you don't get any of the features of Cloudflare Pages though): echo '# Hmm' > index.md npx @11ty/eleventy npx wrangler publish --assets _site/ --name name-of-static-website --latest
- Helmut10001 4y agoStrange that a pretty common way to serve static sites is not mentioned: Multi-stage Docker builds [e.g. 1] an nginx-alpine image in Gitlab CI, that is automatically deployed to Kubernetes/a Docker host somewhere. Add the Let's Encrypt Container for automatic SSL. [1]: https://github.com/lewish/asciiflow/blob/fd0f72714cd307cbb02cf98d708fdd79c1c22f4e/Dockerfile https://github.com/lewish/asciiflow/blob/fd0f72714cd307cbb02...
- hnarayanan 4y agoI highly doubt this is a common approach!
- Helmut10001 4y agoMost mkdocs or hugo sites I see on GH or GL are served this way. Anyway, hard to proove - we need a new study!
- chrismorgan 4y ago> check that with/without .html extension serving works properly; (i.e. /some-file.html should perhaps return the same content as /some-file, or even better, choose one as canonical and redirect for the other one;) Strong disagree. You do not want both URLs to return the same content; you can have alternatives redirect to the canonical URL; but think through why you’re doing it: who is benefited by the redirect? If your canonical URL is /example, I see no reason at all to support .html. If it’s /example.html, I see no particular reason to support /example or /example/. If it’s /example/, there may be a smidgeon of value in supporting /example. If it’s /example and you ever have paths below that (/example/example), then there may be slight value in supporting /example/. If you switch from one format to another, do ensure that all existing URLs work. I used to use .html, so my old *.html URLs now redirect to */, but only for old articles, not new ones that were never .html, because I like being fancy like that. But overall, I say: for at least the .html and trailing slash suffixes, no software should ever be causing these errors (I have heard rumours of improper transformations once or twice, but seen no evidence, and neither of these are ambiguous “will the automatic linkifier include or exclude that punctuation at the end” cases), so it’s all about humans and what incorrect URLs they might type out. And most of these sorts of things, people just won’t do. Supporting more things for the sake of it is not a virtue. There is value in failing early on incorrect input. Postel was wrong.
- ciprian_craciun 4y ago> Strong disagree. You do not want both URLs to return the same content; you can have alternatives redirect to the canonical URL; but think through why you’re doing it: who is benefited by the redirect? At least with regard the with/without slash redirects there is value in these: sometimes the user copy-pastes the URL but forgets the final slash, sometimes the application he is using for bookmarking, sharing, etc. drops the slash; sometimes even the site owner forgets be consistent. Thus having those redirects in place means not having dead links pointing to your site. With regard the `.html`, with and without, it's a matter of taste... However, the same point applies, perhaps you've been inconsistent along the years, thus having redirects saves the dead links... However you are right about the "canonical" URL: for search engine purposes, having a single page serving the content, and the rest being redirects, is kind of essential. (Or at least having a `<link rel="canonical" ...>` if not a redirect.) > Supporting more things for the sake of it is not a virtue. There is value in failing early on incorrect input. Postel was wrong. It is when you don't want dead links. :)
- quintussss 4y agoI use a static site generator, a vps and a git post-receive hook to build and deploy my site. Does not require any third-party providers (apart from the vps) and takes about 15 minutes to setup.
- dusted 4y agoThis is less of an article, and more of an advertisement for cloudflare.. No, you don't need a CDN for your lightweight static site. nginx and your home fiber gigabit connection will do _JUST_FINE_ (tm), even when slashdotted or getting on frontpage at HN. Also, just drop the generators and write your html already.. Sure, it's fun to learn a new toy, but in end, any abstraction between your content and the HTML being served is just another link in the chain of things that can break. Organize your HTML files well, use minimal styling and it becomes quite managable, you literally don't have a technology stack.. just dump the files on ANYTHING IN THE UNIVERSE that has a webserver and a file system, and you're good to go.
- rsolva 4y agoA modest middleway is using Server Side Includes (SSI) to do simple templating stuff. It works on Apache, nginx — and Caddy as well. Its a nice combo of "no stack" and some dynamic elements in your HTML and CSS.
- ciprian_craciun 4y ago[the author here] Indeed I mention Cloudflare quite a lot, and that is for two reasons: (A) If you do want to have a performant website (be it static or dynamic) you do need a CDN with edge caching; else the physics with it's insistence on a cap for the light speed will put a minimum theoretical latency of 25ms say between Bucharest and Toronto, which in practical terms translates towards at least 100ms one way, or 300ms just to establish a TCP connection, and around 500 for a complete TLS handshake... And no amount of bandwidth can solve that. (B) Cloudflare is the only free choice that allows you to use your own domain and that doesn't impose any (published) limits on your usage. If you know of other CDN providers that give you this for free please let me know and I'll add their link to the article.
- Aldipower 4y agoOne forgotten hurdle of static site hosting is in-memory caching. At most http-server default setup each request goes down to the filesystem. Mostly your are lucky and your filesystem itself has some kind of caching mechanism, so you won't notice. But if your static site ends up in a "very high requests" situation, you should think about in-memory caching of your static files.
- Theodores 4y agoWith nginx you should set static files to be on a separate cookieless domain and proxied to a different port with the nginx cache keys set how you want them. You should be using brotli dialled up to 11 for scripts and stylesheets. This takes ages to do if done on the fly but works great if using an nginx cache. Images need to be on another cookieless domain with the cache configured to work with accept headers, in that way you can serve webp instead of jpg, again with the wonder cache able to serve jpg to Internet Explorer and curl, with real browsers getting webp from cache. Nowadays you can use nginx to convert to webp, I use VIPS instead so my thumbnail generator goes from source to webp without an intermediary step with the resized image stored as jpg. Building an origin server for a CDN is a different task to building a regular server. The focus for cached resources is getting the byte size down, not serving a billion requests at once. The CDN can do that. After I built my nginx proxy with cache I was happy with what happens with memory and how the Linux strengths are leveraged with no wheels reinvented.
- ciprian_craciun 4y ago> Building an origin server for a CDN is a different task to building a regular server. The focus for cached resources is getting the byte size down, not serving a billion requests at once. The CDN can do that. I think this put perfectly in words what I've believed for some time, but failed to compile into words... However, having once you've gotten your cached resources down to the smallest size, you can now also optimize for serving a lot of them at once. :)
- pSYoniK 4y agoI just use a VPS, Caddy with a 10 line Caddyfile and scp my html on to the machine. I don't find any real hurdles here and the only thing running on the server is Caddy to serve the content on https/http. Anything that's not a valid path returns a 404 custom page I made and that's it. To get my HTML I use Hugo locally, but I'm not a huge fan of Hugo itself due to it's documentation which cannot be followed linearly and I plan on writing something to do just this - convert some markdown files and a folder structure to an HTML. I'm sure such a tool already exists but I'm curious about building something like this myself. I think the hurdles appear depending on what you expect or want to do with your static page, but the base setup is I think pretty straightforward.
- quickthrower2 4y agoI read this as: The problem is there are 99 ways to do to it from sysadmin-y to cloud-y. My solution is to add 100th way. ——- If static hosting is hard use Netlify or similar. Just point it at your Github and you are done! They mentioned Netlify.
- cobertos 4y agoI've also come across https://staticdeploy.io/ https://staticdeploy.io/ which is self hosted and more akin to something like Vercel which manages a bit more than just serving/hosting. Too bad it doesn't seem fully baked. I love the workflow of Vercel with the auto deployments from git and the infinite deploys via tags. Haven't found a good self-hosted alternative yet.
- Havoc 4y agoThere is another easy option: BunnyCDN. You can just drop the files on there via ftp.
- triknomeister 4y agoStatic hosting on VPS cite is easy as hell. Get a VPS with Ubuntu 22.04 for as low as 3 Euros/Month, execute the following commands: ``` sudo apt-get install -y nginx python3-certbot-nginx certbot sudo ufw allow "Nginx Full" sudo unlink /etc/nginx/sites-enabled/default sudo mkdir -p /srv/https/website sudo chown -vR $MYUSER:$MYUSER /srv/https/website echo "I've created my website here." > /srv/https/website/index.html cat > conf <<- EOM server { listen 80; listen [::]:80; root /srv/https/website; index index.html; server_name $URL; location / { try_files \$uri \$uri/ =404; } } EOM sudo cp config /etc/nginx/sites-available/website sudo ln -s /etc/nginx/sites-available/website /etc/nginx/sites-enabled/website sudo certbot --nginx -n -d $URL --agree-tos --redirect -m $EMAIL --webroot -w /srv/https/website ``` Setup your DNS to the IP of VPS and you're done setting up your static website. Updates now are just `rsync`
- lucideer 4y agoThis is great but what the article is about that you're underestimating is the decision anxiety and subsequent complexity of arriving at the specific configuration you've posted. Even after you've for some reason decided on which tech to use (nginx, etc.), it doesn't set itself up (well it does but not in as easy-to-use config as yours). Examples of how to configure it well are going to vary depending on where you read - your example is unique, which should one follow. Or if you want to create your own config from scratch reading docs, I'm sure your configuration is the product of many hours of trial and error and a bit of debugging. --- As an aside, for anyone reading this who is looking for a good static hosting setup, this is a great one.
- prmoustache 4y ago> This is great but what the article is about that you're underestimating is the decision anxiety and subsequent complexity of arriving at the specific configuration you've posted. The same can be said about finding your static site generator, your favorite social media, the color of your car, your home deco, the race of your next dog... If you want a life where people do the choices for you and stuff edibles into your mouth, there is one easy solution: a nursing home.
- adamaries21 4y ago[dead]
- em1sar 4y ago>hosting these static sites, and we are still in the early 2000s eh no?
- jonathantf2 4y agoOne of the features I don't think Fastmail advertise at all is that you can host static websites from your user storage - with HTTPS etc. You can use one of their subdomains or your own domain, it can do photo galleries I think as well as redirects.
- cloudyporpoise 4y agoAny simple thing can be made overly complex. If you're dealing with a truly simple static site, upload your client-side code to Netlify and call it a day. If you want more control, then it will come with more complexity.
- gamman 4y agoI wonder if HTTP exchanges / Web Bundles (from the Web Packaging proposal) would bring the approach of statically generating request-response pairs more to the mainstream. If I understand correctly, then with both hosting and browser support for Web Packaging proposal, one could even statically pregenerate the whole signed exchange or bundle and skip the server-side TLS part as well. The whole certificate renewal process will probably make that last part nonviable. Not considering other potential effects on the web if the proposal gets adopted of course.