Launch a website for free.
Being able to launch a website for free* is really easy these days.
I prefer writing vanilla HTML / JS / CSS. But to make my life a bit easier, I think I’ll be switching over to using Cactus.
Developing your site
- Write HTML / JS / CSS in some folder called
websitefolder and run the following command in terminal:
python -m SimpleHTTPServer 8000. This will actually serve the
websiteon http://localhost:8000. As a bonus tip, you should edit your
~/.bash_profilefile and set
alias pythonserver='python -m SimpleHTTPServer 8000'. This will allow you to run the
pythonservercommand instead of having to memorize all that python gibberish.
Launching your website
When it comes to deploying your website for the world to enjoy, you have a couple of options.
Options #1: Use github pages. This is a great option for people who are comfortable using git. Basically make a gh-pages branch, and commit your website to that branch. It’s really easy, simply follow the instructions on the website. This option is great for having a simple blog, or hosting small documentations for your open-source projects.
Option #2: Use Surge. This is by far my favorite way. Have Node.js installed on your computer, and run the following command in terminal:
npm install --global surge. Now, you should have access to the
surge command. Simply
cd into your
website folder, and run
surge. After entering in some basic account information, your website will be uploaded and hosted for free. Every time you make a change to your static website, simply re-run
sruge. I’m using sruge right now to host my shahzeb.co website. What’s impressive is that even the images are hosted on surge.
Getting a custom domain
*Hosting is for free, but having your own domain will likely cost a little. Out of all the domain services I’ve used, namecheap is the easiest to deal with. (You can find rad coupons for namecheap here). After you have gotten your custom domain, you can follow these instructions to change the host files for github-pages and for surge.
Support this blog by checking out namecheap.
I hope you found these tips helpful.