Make a website

This is a guide on how to make a website

The Complete (hopefully) Guide to Setting Up a Website

Disclaimer: The following information has been pooled from multiple sources, found by trial and error, or extrapolated. No responsibility is taken by the author for any incorrect or incomplete information, nor for any unintended effects it may cause. Use the information below at your own risk.


Introduction

When I first wanted to make this website, there was a lot of things I didn't know. And I got lots of misinformation from a variety of sources (that I can't remember right now). So I'm going to try to make this a comprehensive guide to setting up a website on Windows, Mac, or Linux. This is going to be a work in progress until I have time to gather screenshots, so bear with me. And, just one last thing: READ THROUGH THE WHOLE TUTORIAL FIRST!

The screenshots will eventually be on all platforms, but I haven't had time to gather them. For registrars, I will have screenshots for name.com and NameCheap.

Before we start with the whole website thing, you need to get to know how websites work. Say I am trying to connect to en.wikipedia.org. My computer contacts something called a DNS server. What the DNS server does is it looks up the corresponding IP address of the domain name. So for Wikipedia, the IP address is 208.80.154.225. I know you're thinking, "What's an IP address?" This is slightly difficult to explain. There are 2 different kinds of IP addresses: local IPs and public IPs. In a more general sense, an IP address is a computer's address.

In a local IP, it's your computer's address in your home network. Say you have 2 computers at your house both connected to the Internet. They will each have their own address in your home network. It will probably be something along the lines of 192.168.x.y (where x and y vary). That is your computer's address in your home network. It is the only one in your home network with that address.

In a public IP, it's your network's address on the entire Internet. I say network because every computer connected to the same Internet connection will have the same public IP. However, your network is the only one in the world with that IP address.

So, anyways, back to connecting to Wikipedia. Your computer then contacts Wikipedia's IP address (208.80.154.225) and says (metaphorically), "Hey Mr. Server! I'm looking for Wikipedia! Is that here?" and the server responds, "Oh, hell yeah! Let me just send you this HTML file that has the front page of Wikipedia on it!"

And there you go. Your computer just connected to Wikipedia and loaded the main page.

Now, back to making your own:

First, you have to decide if you want to buy a domain. Depending on the extension (i.e. .com, .org, or .cc), it probably will cost around $10 USD a year.

Now, this document is going to split. I'm going to assume for now that you want to buy a domain. If you don't, skip down past the domain section.


Getting a domain

Picking a domain

First, you need to pick a domain name that isn't already taken. It should be memorable and have a sort of ring to it. If you can get an actual word, it's an added bonus. If you aren't sure where to start, try your name. For instance, if your name is Joe Bobly, you might want to consider joebobly.com or, in this specific case, joebob.ly I recommend using Domai.nr to get ideas. It'll automatically try to figure out extensions that fit in the word (like joebob.ly). However, it's availability checker isn't very good. (It gives lots of false positives and negatives.) I'd recommend checking the availability on name.com or IWantMyName.

Now that you have your idea in mind (and it's available), it's time to buy.

Buying the domain

Head over to a registrar website that has good prices. I recommend name.com again, because it has a simple, easy to use configuration page with lots of options. However, Namecheap sometimes has better prices.

(Side note: Please don't use GoDaddy. The CEO hunts elephants and may or may not buy the domain you're trying to get and try to sell it to you. That happened to me once and somebody on Gizmodo Whitenoise said they do it a lot. I, however, can't find a link at the moment. Just don't use GoDaddy. Personal opinion.)

Once you've found the domain you want to buy on a registrar, purchase it using a credit card. You may or may not want whois privacy (if it's free, get it, but if not, it's up to you). Name.com does a pretty good job of explaining what whois privacy is:

Whois Privacy allows you to register domain names privately by protecting your contact details such as name, email, address, and phone number from public view.

If someone wants to buy a domain, they must give all of their information, including street address and phone number, to the ICANN (the Internet Corporation for Assigned Names and Numbers). The ICANN then puts that information on public display through whois. If you do a whois search (go to who.is) on any domain, you get all that info about the person. If you buy whois privacy, however, it hides that info (do a whois search on boj.cc, for example).

Anyways, now purchase your domain, with or without whois privacy. (From now on, I'm going to pretend the domain you bought was joebob.ly.) Now, you need to find the dashboard for domains. Find somewhere where it says Edit DNS Records or DNS Record Management or something. Depending on your registrar, there should be a page for modifying DNS settings. Don't mess with the nameserver addresses (I'll explain those later). There should be a few columns. One of them should be Type. Change it to A. This tells the DNS server that you want an A record. From Wikipedia, an A record:

Returns a 32-bit IPv4 address, most commonly used to map hostnames to an IP address of the host, but also used for DNSBLs, storing subnet masks in RFC 1101, etc.

Woah, wait what? That made no sense, right? Let's break that down:

Returns a 32-bit IPv4 address

We can ignore the 32-bit part. An IPv4 address is just a fancy name for an IP address (well, for our purposes). So back to the A record definition. It basically tells the DNS server, "If anyone connects to you looking for joebob.ly, send them to this IP address!" The DNS server will gladly do that, as that is its job (remember the Wikipedia example?).

Now, you need to look up your IP address. It's really not hard to look up your IP--it's sent to every website you go to. The most convienient IP address lookup is at l2.io/ip. Copy that number, as you are going to need it very shortly.

Now, enter that number in the Answer (or similar, as always) section of your domain control panel. For the host, leave it blank if you want people to connect to your website by going to joebob.ly, or enter www if you want them to connect by going to www.joebob.ly.

Hit save, and we are done configuring your domain!

Now, if you go to joebob.ly, your website should be there!

Well, not actually. But, you're halfway there!

Setting up your server


Side note: If you did not buy a domain, you will connect to your website by going to your IP. Find that by going here.

This tutorial is only going to cover self-hosting the website, as that's what I do and know how to do. However, be warned that this requires your computer to be open 24/7.

There are bundles of software that you need to host websites (well, you can do it with other software, but it's easiest for beginners to not worry about configuring NGiNX). They are called _AMP programs, where the _ represents the operating system. The AMP part stands for Apache MySQL PHP, generally.

(I say generally, because sometimes the P is replaced by Python or Perl, or one of those is added to the end. Also, NGiNX is better than Apache IMO because it's faster, but it's a lot harder to configure, so I'll leave that out for now.)

Apache hosts the website, MySQL stores data, and PHP is a programming language for the web.

For Windows, there are two (major) choices of _AMP stacks. There is WAMP, which is more commonly used, if I understand correctly, and there is XAMPP (Cross-platform (x) Apache MySQL PHP Perl). To be honest, you could use either (I haven't used either for a few months, switched to Linux), but I recommend XAMPP, because I couldn't get WAMP working on my friend's network for some reason. To install it, just go to the XAMPP site and follow their instructions. It's not hard, really, and if you've made it this far in this guide, it will be a piece of cake.

For Mac, there are (again) two major choices: MAMP and XAMPP. In this case, I definitely recommend XAMPP, because it's a ton easier to use, and it's easier to configure. To install it, just go to the XAMPP site and follow their instructions. It's not hard, really, and if you've made it this far in this guide, it will be a piece of cake.

For Linux, I recommend just using a plain LAMP stack that you kind of make yourself. The Arch Wiki has a good tutorial on how to set it up. Just remember that you need to replace all instances of pacman -S with your distro's install command. Also, package names might be different, just search the Internet for something like php5 debian. You might also want to consult this excellent tutorial if you run into trouble.

After you have that all set up, you need to port forward. This tells your router to send all of the traffic on port 80 (the default port websites run on) over to your computer. Go to portforward.com for a terrific guide. Select your router and choose Apache for the program.

Test

Connect to your website by going to localhost. If any page loads, you set up the _AMP correctly! If not, see below. Now, go to canyouseeme.org and press Check your Port! If it says Success!, then move on. If not, though, go to Troubleshooting below. Our final test: Call up a friend and ask them to go to your website. If they can, you are good! Go ahead and replace index.php with any HTML page you can conjure up, and you are good to go!

If you don't have any friends, go to HideMyAss or Zend2 and try to connect through there.

Troubleshooting

Did you port forward correctly?

Go back to the portforward guide, fix what you did wrong, and check again!

(Some internet service providers, in an effort to reduce their expenses, block port 80. If you've port forwarded correctly and everything, you might need to call them.)

Could you connect through localhost?

If no, see if you can find your mistake, and if not, go to the corresponding forum!

Your friend can't connect, but portchecking worked and so did the localhost test?

Double check your DNS records for your domain.

One last message

Have fun! Try to learn HTML (go here or here). Feel free to email me with any questions relating to this setup.