If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Hosting your website on a server

In this article, I'll walk you through one way that you can take your webpage and host it on your own server.
Why would you want that? And what's a "server" anyway?
When you visit websites on the internet, they are each hosted by a "server". A server is a computer located somewhere in the world that's connected to the internet, and that computer's job is to "serve" webpages to internet users that want to view them.
Diagram of a laptop computer and a server, with an arrow between
A laptop computer shows webpages served by a "server" computer.
When you create webpages here on Khan Academy, it's the Khan Academy servers that are in charge of serving your webpages. That's nice of us, since you can share your webpages with friends for free, but there are some disadvantages: 1) your webpages have a bunch of Khan Academy user interface surrounding them, 2) your webpage has "khanacademy.org" in the URL, and 3) you can only create single webpages, not multi-file websites.
All of that is great when your goal is learning, but not ideal if your goal is to create a professional looking website, like a portfolio, resume, or shop.
When you develop webpages on your own computer, then you can create multi-file websites that aren't surrounded by Khan Academy UI - but the URL of your site looks like "http://localhost" or "file://...".
If you try sharing a URL like that with a friend and they try loading it on their computer, they'll be sad because they won't be able to see your website! Those URLs are "local" URLs, only viewable on your own computer.
So now you need a server to "host" your webpages, and that's where you have a lot of options. Many companies are "hosts" or "hosting providers", and they make money by letting people host your webpage files on their servers.
You might also want your own domain name - like "khanacademy.org" or "yourownname.com". You can buy those from a "domain name registrar", pay a small amount each year to keep them around, and then point that domain to your server. You can also learn more about domains, from the inventor of the internet himself!
You can search the internet for "hosting providers" and "domain name registrars" if you want to check out all the companies offering those services and see what their pricing is like.
Since this is Khan Academy, where we like to enable you to learn skills for free, I'm going to show you an option for hosting your website for free on a place called Github.

Want to join the conversation?

  • piceratops ultimate style avatar for user Nabil Daoud
    Who sells domain names? I guess to be more specific who owns a domain before I buy it. Say I want www.[myentiregeneticcode].com--I'm going to assume that hasn't already been purchased--why does it make sense that I would pay money year after year to a domain name registrar to use that domain?
    (40 votes)
    Default Khan Academy avatar avatar for user
    • old spice man green style avatar for user Bob Lyon
      (Usually) Nobody owns a domain name that does not exist. You dream it up, then register it.

      If you pay a registrar, you get what they offer: a registration of your domain name and a list of IP addresses where name resolvers can visit to map xyz.yourentiregeneticcode.com to their appropriate values.

      If you don't register your domain name, you run the risk of someone else snapping it up as their own.
      (52 votes)
  • hopper cool style avatar for user 🍕MBONKA🍕
    What exactly does http://localhost mean? Does it mean that only people on your server can view that page?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • old spice man green style avatar for user Bob Lyon
      The short inaccurate answer is "yes". The accurate answer is more involved.

      http://localhost is a URL that points at your (local) machine. You could also embed your "local host" IP address in the URL and accomplish the same thing - http://127.0.0.1 .

      It does not necessarily mean that only people on the local machine can view that page. That page may be viewable via a variety of URLs, many being "legitimate" web based URLs. For example, my page can be view via http://la94022.com/~blyon/Javascript/paddle/ , but when I run a browser on on the server of la94022.com, I can also get at the page via http://localhost/....

      The point being that anyone can run a web server without doing the work of making it visible to the world. But accessing the web server's pages may only be viable by local access.
      (19 votes)
  • leaf yellow style avatar for user Doston ✔️
    Can I use my own computer as a server?
    (8 votes)
    Default Khan Academy avatar avatar for user
  • male robot johnny style avatar for user Mohamed Ibrahim
    Someone correct me. You can host your site on your own computer but it has to be always turned on. I mean you can't shut down your computer, then.
    (6 votes)
    Default Khan Academy avatar avatar for user
  • duskpin ultimate style avatar for user Kolluru, Sanjana
    How do you set up a website without spending money? I mean, how did the first website ever go online when buying domains and hosts wasn't a thing?
    (4 votes)
    Default Khan Academy avatar avatar for user
    • old spice man green style avatar for user Jim E
      Domains and hosts existed before the web. There where already services like smtp (e-mail) and ftp. Also irc, newsgroups and gopher existed. The http protocol was just an addition to the existing services.
      Early on you could just reserve ip addresses and a domain name for a small expedition fee. Some early orgaisations could negotiate to handle the root servers for a country domain and so had rights to create all sub domains.
      Still you needed to buy servers for dns and hosting, and have some network connection to a backbone provider. Or be an operator. So it have never been free.
      I think it have never been as cheap as now when you can just buy a web hosting service with everything included.
      (8 votes)
  • old spice man green style avatar for user hammadalimiandp3
    if i put my webpage on github, can i remove that later from github ?
    (6 votes)
    Default Khan Academy avatar avatar for user
    • leaf red style avatar for user lukasexists
      Yeah, I'm pretty sure you can just delete the repository.

      Or, if you don't want to delete the whole repo:
      1. Go to the repository's Settings tab
      2. Go to the Pages menu (under Code and automation.)
      3. You can click the ... button next to the "Visit site" button and click Unpublish site.
      (1 vote)
  • leaf green style avatar for user mdar
    Can I make my own domain, or buy it off a registrar for myself to manage?
    (3 votes)
    Default Khan Academy avatar avatar for user
  • winston default style avatar for user John
    Where are the dn servers located?
    (3 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user kharwadeyshrujan
    dear mam and sir,
    when i will be able to make games based on the codes i have learned..can we also make games by html and css as our tool....and please mam and sir....please tell me what is github actually as i just searched for it and got quite confused what to do next?
    (3 votes)
    Default Khan Academy avatar avatar for user
    • duskpin ultimate style avatar for user programmer
      For making browser games, you will have to use javascript. Depends what type of game you are making, if you are making a 3D game, you would need to use WEBGL. Now learning WEBGL wouldn't be a fast method so you might wanna use a library like THREE.JS to make your coding easier.
      For let's say 2D games you can take Khan Academy's JavaScript course, where you will be taught with the processing.js library
      Also, you don't necessarily need to use libraries, they are there just to make it easier for you. You can very well code in raw javascript if you feel that's a better idea and more comfortable for you.
      (3 votes)
  • blobby green style avatar for user Dave
    Is there a website that provides domains for free? For example, could I get mywebsitecoding.com without paying money?
    (2 votes)
    Default Khan Academy avatar avatar for user