Getting a Website Up

January 26, 2020

After thinking about setting up a website for years, it was time to stop procrastinating. Part of what was holding me up is that the entire process seemed like a gigantic PITA. Like most things, it's not that bad once you start.

Another reason it was hard to get excited about setting up a website is that, based on the little I knew, the tools used to build websites weren't very appealing. I'm still not impressed, but that may change as I learn more.

I started messing with computers years ago on a Radio Shack TRS-80 Model I. Later, I gained experience with PDP-11, TOPS-20, the VIC-20, Data General Eclipse, VAX/VMS, along with various generations of Apple computers, Sun Workstations and Windows machines, and there are probably systems I've forgotten. Today, I prefer Linux. For many years, my language of choice was C, then C++, and now it's Java. Of course, there were other languages too – I started composing a list, but most of those languages are dead. Are there any Modula-2 programmers out there? How about SAIL? I thought not.

The point is that, before starting a website, I knew a fair amount about computers in general, but had never done more than glance at the languages and infrastructure used to set up and maintain a website. Six weeks ago, I knew almost zero HTML, CSS or JavaScript, and had no idea what WAMP stands for. On the other hand, I was playing with TCP/IP protocols back when the internet was limited to a few university sites.

Getting a Domain Name and Host

Once you have a domain name and a server to host your website, you're halfway there. Unfortunately, there's so much spammy advertising and marketing noise about this topic that searching the web isn't very helpful. If you're lucky, you have an acquaintance who's a web developer and can point you in the right direction. If not, then I found that Namecheap was a good place to register the name. Once I had that, DigitalOcean provided a server. Using something like GoDaddy might work too, but I wanted something more flexible than what GoDaddy (and similar hosts) provides. If you have any real computer chops, then you probably want to avoid GoDaddy and the like; on the other hand, if you are not very computer savvy, then GoDaddy et al. may be a better choice.

The choice of host comes down to how much coding you want to do, and how comfortable you are with system administration tasks. Based on web searches, it initially seemed that everyone is using WordPress. I was only vaguely aware of it, so I downloaded it and spent about two weeks playing with WordPress. I found it to be a frustrating disaster area. Maybe someone who designs websites for a living and knows its quirks can make better use of it, but it was too cumbersome for me. That said, if you just want to set up a simple blog and are willing to stick with the templates provided by WordPress, and you want to avoid coding at all costs, then something like WordPress and GoDaddy might work for you.

Whichever route you take, the process of getting a site up is mostly one of following your nose. Even so, it's still useful to know where your nose will take you. There are three big steps.

Providing Content

So far, you have a domain name and a host, but there's no content. Anyone who goes to your website will get some kind of "page not found" error. The host exists, and people are finding it, but the host doesn't know how to respond to requests for content. You need a web server!

This website runs on Linux because that's what I know best. At this point, the discussion parts ways with people who want to use WordPress, or who want to use a Windows-based web server. If you're minimally comfortable with Linux, then read on.

Since you are comfortable with Linux, it's enough to note that something like

    apt install apache2

does the trick. After this runs, you have an Apache web server. It listens for page requests and provides whatever is requested. Depending on how the host is set up, you may also need to change firewall settings to allow these requests to get through. The ufw (Uncomplicated FireWall) command handles that.

Once the server is up, look in /var/www/html. There should be a file named index.html. This is your home page. By default, it will show something like "Apache2 Debian Default Page." When people go to your website, that's what they'll see.

Next you'll want to change the home page to provide your content. Obviously, the first thing you need to do is compose the content. I'm not going to try to provide any kind of tutorial on HTML or JavaScript since there are plenty of places for that.

To compose your content, you can simply type HTML/CSS and JavaScript into a text file on your home machine, then open it as a file with your browser. That works up to a point, but lots of things won't work without access to a web server. In particular, hyperlinks to go from page to page, and various aspects of JavaScript (like Ajax requests) won't work. For those to work, you need a local web server – a LAMP or WAMP (Linux or Windows Apache MySQL PHP) server. Install one of these, and you can then edit your website off-line in a way that better reflects what visitors to your website will see. In fact, you may want to install this and compose some content before you even have a host name. Composing a few pages will tell you whether the entire endeavor is worth the trouble.

Once you have some content, it needs to be uploaded to the server. Lots of people use something called cPanel to do this, but I know nothing about how that works. Instead, a few Linux commands get the job done. For your first home page, as a test, you might compose some HTML that looks like:

<html>
    <body>
        <h1> Welcome to my page!</h1>
        <p> There's nothing here yet, but I'm working on it.</p>
  </body>
</html>

Store this in a file called index.html. This will be your new home page. Use sftp to replace the original contents (as found on the server) of /var/www/html/index.html. Now, when people go to your website, they'll see

    

Welcome to my page!

There's nothing here yet, but I'm working on it.

If you want to upload an entire directory-tree of content, then you can either tar it up into a single file and transfer it, or use some other solution.