Deploy a Static Site in 3 Steps πŸ‘†πŸΌβœŒπŸΌπŸ€ŸπŸΌ

Sarthak Sharma on April 04, 2019

So you just made your first static website. Awesome! Now you are ready to share that with your friends and the world. But you are stuck reading tho... [Read Full]
markdown guide

To be frank, if you're setting up a VPS for a purely static site, you've kinda missed the point of it. Static sites offer so much more potential than just a website that doesnt run server-side code.

If you're going through the trouble to set up and manage your own webserver, you might as well drop some PHP or something into it to get the most out of it.

And publishing a static site locally and deploying via SCP simply will not scale. A big reason why you'd choose a static site is so that you can build and deploy a long, expensive build process on a CI server rather than making the expensive calculations/HTTP calls at runtime. Having CI, you get to simply push to a git repo and know it will be deployed soon, and never have headaches over how long the build or upload is going to take.

You should also take advantage of the fact that a static site can live on a CDN, which will make delivery faster than serving it form a Droplet, and also will never get overwhelmed with huge spikes in traffic.

As others have mentioned, there is a completely different set of hosting providers for static sites: Netlify, Zeit Now, all the major Git hosts provide static hosting, AWS S3+Cloudfront.


Articles like this are dangerous. No mention of firewall settings, securing the server, automatic security updates, nothing.

Setting up servers is not something you should do carelessly, even if it's not for production.

You may not care if your server is hacked, but it then becomes a vector for outgoing attacks.

If you don't know how to do this properly, hire someone or use a service.


Purpose of this article is to get beginners started. I have talked to many new developers who got scared after all these setups and because of that they don’t even start. So I just want to take the fear away and help them enjoy the joy of deploying for the first time. Also in follow up articles, I’m going to explain how to secure the server.


Then you should specify this, with emphasis, at the beginning of this article. Too many people do a quick Google search & think they are sysadmins.

Even after 15 years as a dev & a couple years learning these basics, I would not attempt to set up a publicly accessible server myself yet.

People need to be responsible.

I have emphasized on this, if you read the article, and mention that it’s just for beginners. I respect your concern here and encourage you, being an expert, to write an article about how to secure such a server. It will be great learning for beginners coming to this article and guess what, I will also link your article in my post. 😊
Remember, the goal here is to inspire beginners.

It's cool to write articles for beginners, of course.

But instead of promoting your DigitalOcean referral link, you should have them use a virtual machine on their local computer. Where they can learn & experiment in safety.

Damn, I don't know miss, how I offended you but I'm just trying to make you understand that we are on the same side. Anger makes you blind. Btw

you should have them use a virtual machine on their local computer. Where they can learn & experiment in safety.

I have

Lol I'm not angry.

Just disagreeing with you.


Netlify is a great option for static sites. You get hosting, https, and a build pipeline for free...very easily even with a custom domain.

Best of all, it's a cdn so your site is available from multiple nodes around the world so you've got great performance a d resilience out of the box...for free


So nice gotta try this too.


I don't know if better, but for free there are a couple of solutions to deploy static sites like Firebase, GitHub Pages, Now, Netlify or Heroku (and I might be forgetting a couple of them).


Yeah, of course that’s an option too.


Static pages using all this setup ? And on top of that pay 100$ , why ?
There are easier options without having to install any server like github-pages.
Heck, gitlab lets you host static websites from private repos for free plus it gives gitlab-ci which can do auto deploy each time you push a commit.
To be frank this seems a lot click-baity title to me and way too complicated for something as easy as hosting static sites.


Good tutorial but I prefer S3 for static websites (simple and cheap)

This is good if your website requires some server-side code tho


I appreciate the content as always, but I feel that you should disclose that the DigitalOcean coupon is actually a referral link. Otherwise, it seems like you are trying to draw people in with the promise of an easy way to set up a static site (a hot trend right now) when the real intention is setting up a DigitalOcean account (via your referral). The bulk of the post does not pertain to static sites, so you could see how others could reach the wrong conclusion.


Or just use free github pages??


Thank you for that I always wanted to know how to handle that part of the Development


I prefer Jekyll with GitLab/GitHub Pages for free. Zero setup.

BTW, the difference between the two is that GitLab Pages are free for private repositories and GitHub Pages are not.


GitHub now also has free unlimited private repos (personal only though). They also do work with GH pages nicely.


As I said, GitHub Pages are limited to public repositories in the free plan. If you go to Settings of your free private repository you'll see the following message in the GitHub Pages section: "Upgrade to GitHub Pro or make this repository public to enable Pages."

That's why GitLab does it better in this case.

Whoops, my bad. I saw the "free private repos" blog announcement and immediately tried it. Seemed to be working fine and private, but I forgot that I have acquired GH Pro recently. Yeah, GitLab is certainly still the way to go for private hosting.


In the examples you use scp. There is also rsync which has a lot of other options.



That’s neat. Thanks man.


I feel easiest and scalable would be hosting it on aws s3 than doing this way on digital ocean.

With aws s3

  • you can scale up without doing anything,
  • 99.99 % availability
  • cheap
code of conduct - report abuse