DEV Community

loading...

How do you host a website for free?

pandaquests profile image pandaquests ・1 min read

Discussion (35)

pic
Editor guide
Collapse
patarapolw profile image
Pacharapol Withayasakpunt
  • Heroku - Self-made backend; however, if you use your URL, getting HTTPS is a little complex (might need Cloudflare).
  • Firebase hosting - Firebase suite -- login / database / functions / analytics
  • Netlify - CDN-based static hosting with optimizations (you can choose plugins) / also Netlify functions are free to an extent.
  • Vercel - Easy static hosting with serverless functions / also support things like Heroku to some extent.
  • GitHub Pages - Static hosting OR Jekyll-based
Collapse
alantelles profile image
Alan Telles

Is it possible to have https for free in heroku?

Collapse
patarapolw profile image
Pacharapol Withayasakpunt

*.herokuapp.com has HTTPS by default, but just need to redirect your server for it.

Custom domain can have HTTPS, if you either,

  • Use at least Hobby Plan (i.e. pay around 7 USD / mo)
  • Hide behind an HTTPS proxy -- I use Cloudflare in this case.
Thread Thread
alantelles profile image
Alan Telles

I deployed a flask site and all the relative links points to http. I open with https, but the internal links point to http

Thread Thread
patarapolw profile image
Pacharapol Withayasakpunt

Have you tried --

python flask redirect to https from http

28

I have a website build using python3.4 and flask...I have generated my own self-signed certificate and I am currently testing my website through localhost.

I am using the python ssl module along with this flask extension: github.com/kennethreitz/flask-sslify

context = ('my-cert.pem', 'my-key.pem')
app = Flask(__name__)
sslify = SSLify(app)

...

if __name__
…

You don't need a real SSL certificate, BTW. Just need to differentiate DEVELOPMENT from PRODUCTION.

You can also adapt this code, as some of the things are Heroku-specific.

help.heroku.com/J2R1S4T8/can-herok...

Collapse
bradtaniguchi profile image
Brad

great list of free resources!

Collapse
pandaquests profile image
Collapse
pandaquests profile image
pandaquests Author

Thanks. Great list

Collapse
philipperoubert profile image
Philippe Roubert

You can also use AWS' free tier. Been hosting my site there for free πŸ‘

Collapse
seveneye profile image
seveneye

May I know what product are you using for the free tier. EC2 ? Elastic beanstalk?

Collapse
philipperoubert profile image
Philippe Roubert

Just checked, I'm running an Elastic Beanstalk app itself running an EC2 instance.

Elastic Beanstalk doesn't cost anything. EC2 has 750 hours free per month (which ultimately means you can only run one instance) for 12 months.

Collapse
pandaquests profile image
pandaquests Author

Is it for free forever? Or only for a limited time, e.g. 30 day?

Collapse
philipperoubert profile image
Philippe Roubert

Pretty sure it's forever, the catch isn't about how long you use it but rather how much computational power you use. But for a small site, you shouldn't worry about it much. I have a site with max. a couple of thousand views per month and never had to pay a cent.

Thread Thread
pandaquests profile image
pandaquests Author

But what happens when there is a spike of views, e.g. a DOS attack? Would you have to pay then or did you make some precaution that the views would never reach a certain threshold?

Thread Thread
philipperoubert profile image
Philippe Roubert

It seems like AWS has its own DDOS protection service
aws.amazon.com/shield/?whats-new-c...

I personally haven't undertaken any measures regarding denial of service attacks, perhaps if my site reaches a certain size.

AWS can be quite confusing, but it's the biggest hosting provider at the moment (I believe), I think it's worth looking it up and researching πŸ‘

Collapse
philipperoubert profile image
Philippe Roubert

Apologies, I need to correct myself!
I made a little bit of research, it's free for 12 months, so not indefenitely.

However, once these 12 months are done, you only pay what you use.

Thread Thread
pandaquests profile image
pandaquests Author

Thanks for clarifying

Collapse
williamhenderson profile image
William Henderson

GitHub Pages ftw

Collapse
aleksandrhovhannisyan profile image
Aleksandr Hovhannisyan

GitHub Pages is great, but eventually you come to realize that it's not. Netlify has so much more that GitHub Pages is lackingβ€”plugins, redeploys, stop auto publishing, and a bunch of other useful features.

Collapse
pandaquests profile image
pandaquests Author

I'm hosting my website for free on github pages, too. But it doesn't support https. Therefore most people would see an warning page.

Collapse
williamhenderson profile image
William Henderson

Not only does it support https, it forces it... Have you messed up the configuration?

Thread Thread
pandaquests profile image
pandaquests Author

Ah, my bad. It is using https. But the certificate is not valid:

pandaquests.de

Thread Thread
williamhenderson profile image
William Henderson

That's because your certificate is provided by GitHub but your hostname doesn't match... I think you have to either switch to http or provide your own certificate

Thread Thread
pandaquests profile image
pandaquests Author

Ok. I'll have a look how I can provide a certificate.

Thread Thread
artis3n profile image
Ari Kalfus

You can use a custom domain with GitHub Pages and get a valid certificate from Let's Encrypt automatically. You need to ensure you have a CNAME file in your repo and your DNS settings are set up correctly. Check out docs.github.com/en/github/working-...

Thread Thread
pandaquests profile image
pandaquests Author

Hmm... I think I did that. But it still says my certificate is invalid

Collapse
andrewbaisden profile image
Andrew Baisden

Netlify, Vercel, Heroku, Github Pages

Collapse
pandaquests profile image
pandaquests Author

I'm also using ghPages. Will look into the others. Thanks

Collapse
kostjapalovic profile image
Kostja

aws.amazon.com/ AWS gives you a year of free resources.
appliku.com/ gives you a free plan to deploy your app on AWS, so you don't have to waste time on DevOps

Full disclosure – I am maker of Appliku.

Collapse
preyasprathap profile image
Collapse
vuelancer profile image
Vuelancer

Free static site hosting services

  • Hostman
  • Surge
  • Deta - nodejs app
Collapse
mzaini30 profile image
Zen

For my blog (mzaini30.js.org)

Hosting: Github Pages (free)
Domain: JS.org (free)

For web app demo

Hosting frontend: Github Pages (Vue, free)
Hosting backend: nasihosting.com (PHP, MySQL, free)

Collapse
jonrandy profile image
Jon Randy

fast.io for static sites

Collapse
expressgradient profile image
Praneeth

Firebase Hosting, Vercel etc

Collapse
pandaquests profile image
pandaquests Author

Thanks, I'll have a look