How to Make A Website

Here’s what goes into a website.

I will explain what these terms mean, and how to get your own stuff set up. Please note that this is a guide for people who want to do everything from scratch. There are plenty of easier ways to set up a website. For instance:

How the internet works

When you type “reddit.com” into your browser, here’s what happens:

Now, what we want to do is the same thing that reddit is doing. So, let’s go over the list of things again:

Before we proceed, I should mention that I AM NOT A SECURITY EXPERT. If you’re going to be handling any sort of sensitive information, please, PLEASE, do some research, and try to consult with someone who knows what they’re doing. If you only follow my advice, you should assume that anything you put on your server is immediately compromised.

Server (hardware)

Basically, we’re going to rent a computer from someone for your website to run on. There’s a bunch of services to do this, each with their own advantages and problems.

My personal website uses Linode. Their servers start at $5/month for a so-called “nanode”. When I need to explain something, I’ll use that as the example.

I won’t say that I have any great familiarity with the market, so do your own research. The important point for this tutorial is that you get full root access to a server running something like Ubuntu linux.

A lot of services “manage” you in various ways - providing a standardized webserver (as in, software running on your server), limiting the stuff you can do on the server, etc etc. These are not necessarily bad ideas, but it’s not what we’re looking for.

You can also run whatever OS you want on your server. You’ll almost certainly want some variation of Linux. I’ll use Ubuntu for this guide. If you’re using a different version, things will obviously be different.

You can see the IP addresses on the right.

Now you’re running a terminal on your server.

Server (software)

We’re gonna use a program called nginx to serve our website.

Now, I’ll explain how to configure nginx to serve your website.

<html>
    <head>
        <title>Welcome to example.com!</title>
    </head>
    <body>
        <h1>Success!  The example.com server block is working!</h1>
    </body>
</html>
server{
        listen 80;
        listen [::]:80;

        root /var/www/example.com/html;
        index index.html index.htm index.nginx-debian.html;

        server_name example.com www.example.com;

        location / {
                try_files $uri $uri/ =404;
        }
}

Obtaining a domain

Now let’s buy the example.com domain.

(Obviously you’ll type in your domain at the top). Note that you must enter an email address.

HTTPs

Now we’ll set up security for your site. Luckily, this is super easy.

What now?

Now you’re set up! Put any files you want to put on your website into /var/www/example.com/html