Make your own site!


This guide is not 100% perfect, and I'll probably get things wrong. Make sure to watch tutorials or someone like Luke Smith (his website tutorial videos). I'm not responsible for any damages caused.


To create a website... you even don't need to know much! I made my first sites when I was 12, so programming and "programming" can be done at any age. Firstly - you need to get some basic Linux and HTML knowledge.


To summarize how HTML works - everything is a component. You start it with <component>, add the contents (text, images, whatever) and then end it with </component>. Now you have a container with stuff in it!


A per Linux... it's a little complicated, but isn't as scary as it sounds. ls shows the files in a folder. mkdir creates a folder. cd puts you in a different folder. pwd shows the folder you are in.


cp copies files. mv moves and renames files. rm deletes files. Make sure to include -vr to include folders and to know what it's doing.


Linux and HTML tutorials are a YouTube search away, so make sure to watch them.


There's this very basic, but straightforward boiletplate, that is very underrated. You can add navigation and footers around this <main> tag, then search engines like Google will only focus on the content inside this <main>.


<!DOCTYPE html>
<html>
    <head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<link rel="stylesheet" href="style.css">
	<title>Your website title, or basically the text showing in the browser tab</title>
    </head>

    <body>

	<main>
	    <!--  CONTENT GOES HERE  -->

	    <!--  CONTENT ENDS HERE -->
	</main>

    </body>
</html>




Getting your site online


To have your site public, you don't have to necessarily buy hosting, unless you want to integrate it with a domain name and host your own email. This section will cover getting it online using external sites, and getting it online by buying a domain and hosting.


Free hosting


I've never used any of them, but free hosting is great if you can't afford hosting or simply want more privacy.


Neocities is a great starting point. It has a text editor built inside, even a damn search engine! Codeberg is a privacy-friendly GitHub alternative, which can be used to get your site on Codeberg Pages. The URL should then look something like this.



The internet works like real life addresses. They are identified with something like 308 Negra Arroyo Lane, Albuquerque, New Mexico 87104, but in reality lead to specific coordinates for a specific location. It's the same for the internet - domain names lead to IP addresses. The URL bar identifies this lead as the domain.


For the regular internet there are domain registrars, which hold all of the domain names. You need to buy one, doesn't really matter where, just somewhere cheap. I'm satisfied with Porkbun, because of how cheap their domains (and costs actually) are.


The second thing you need is hosting. In the start I've used Vultr, but it just parrots the same prices ($5), which I'm not paying. I'm hosting a site and email at LunaNode, which has a good VPS price ($3.5).


Create a Porkbun account and register a domain to your liking, although I highly advise you to go with .xyz - it has one of the cheapest costs. Don't forget to enable WHOIS protection, it prevents the domain registrar from showing your personal info.


Although you could use Vultr, Linode or DigitalOcean - LunaNode and BuyVM/Frantech are much cheaper. If you find any cheaper ones, use them and let me know. However just make sure they aren't blocking ports, like email and web ones.


Now that you've bought your domain name and VPS - it's time to wire them together. Go to the Porkbun dashboard and click on the "DNS" link. Add an A record pointing to the VPS IP address.


Now, we're into some real shit. Assuming you've already written your site and bought an Ubuntu VPS, now we're gonna log into it and install nginx and certbot. Alright, so the LunaNode page should give you the username and password to log in.


ssh <username>@<vps ip address>

NOTE: It is highly advisable to change the password for the user (and write it down), because if an attacker gets access to the LunaNode account, they'll see that Linux account password and you'll get hacked.
sudo passwd <username>



sudo -i to get access to the root shell.


apt update && apt upgrade


apt install nginx certbot python3-certbot-nginx
will install nginx (the web server), certbot (HTTPS) and python3-certbot-nginx (integrate certbot into NGINX).


An example NGINX configuration would be something like:


server { listen 80; listen [::]:80; root /var/www/html; index index.html; server_name YOUR.DOMAIN; location / { try_files $uri $uri/ =404; } }

The root parameter is the webroot directory - that's where your website is hosted. You need to change the underscore at server_name to your domain name.


Copy the configuration above and create a new file - /etc/nginx/sites-available/YOUR.DOMAIN. Paste it there. Now you need to enable the site by running - ln -sv /etc/sites-available/YOUR.DOMAIN /etc/sites-enabled/.


Your website is currently insecure, so let's NOT make it insecure! Generate a new SSL/TLS certificate by running certbot --nginx and select your domain name.


Running systemctl restart nginx should apply the configuration, and we should be ready to go.


Updating your site


Since you're just starting out - I'd recommend using WinSCP or FileZilla to upload the website files to /var/www/html or wherever your webroot directory is.


Keep in mind that you'll need to have root access, therefore very careful. If you use a SSH key to upload the site files using root, make sure it is generated with a password.


Another rule of thumb you should follow is getting into Bash scripting. It automates those specific tasks, and since you'd know the coreutil commands - you'd have nothing to worry about.




Written by VickyTheChills on May 21, 2022 at 17:54:13 EEST