Supercomputer from Wikipedia
| | |

How to Make Your Own Website For Free (Except Domain Names)

How to Make Your Website

In this Tutorial, which will be a several part series. Making a website is not easy, so in this part of the tutorial, I will be going over the first part of making your website. The stuff in this tutorial is required by either security or just having a website that exists. We will be using a LAMP server as the software for this server. LAMP stands for Linux, Apache, MySQL, and PHP.

What You Will Need

You will need the following things to set up your website:

  • A computer that you don’t mind all of the information being deleted from and don’t mind running 24/7. You can also use Amazon Web Services for this, but I prefer to do it the old-fashioned way because you can only have your website free for a year if you use AWS.
  • A USB stick to install Ubuntu with
  • An internet modem or router that you have control over.
  • You’ll want another computer that you can use to log into the other computer remotely.
  • An internet connection
  • A little elbow grease

Instructions

These are the instructions that will guide you through setting up your website.

Setting up Your Computer

Ubuntu Logo
The logo for Ubuntu

Setting up Ubuntu Linux is pretty simple. To set up Ubuntu Linux, you will want to follow the Ubuntu Linux installation instructions outlined in The Poor Man’s Guide to Making a Supercomputer. You will also want to go ahead and install SSH and FTP, which is also described in The Poor Man’s Guide to Making a Supercomputer.

Installing the LAMP Server

Apache Logo
The Apache Logo

Installing LAMP is not very difficult at all. All you have to do is run the following commands in SSH.

sudo apt-get update && sudo apt-get upgrade
sudo apt-get install apache2
sudo apt-get install mysql-server
sudo apt-get install php-pear php-fpm php-dev php-zip php-curl php-xmlrpc php-gd php-mysql php-mbstring php-xml libapache2-mod-php
sudo service apache2 restart

PHP Logo
PHP: Personal Hypertext Processor

Once the commands are entered, that should have installed all of the information. Next, you need to test to make sure that everything worked properly. To do this, you will want first to attempt to connect to the apache server. Go onto the computer that is running the server, open firefox, and type in the URL http://localhost. If the browser doesn’t give an error, then it works. Finally, you need to test your PHP installation. To test your PHP installation, type the following in SSH:

See also  How to Play Minecraft: Java Edition on a Chromebook

php -r 'echo "\n\nYour PHP Installation is Working!\n\n\n";'

If the command line told you “Your PHP Installation is Working!”, then, as it stated, your PHP installation is working. This means that everything is installed correctly.

Setting up MySQL

MySQL Logo
The MySQL Logo

MySQL installation is a bit more complicated. To set up MySQL properly, you will want to enter in the following command in SSH:

sudo mysql_secure_installation

This will send you a bunch of different options. Use your best judgment on each, so that your security will be to what you prefer. Once the command is finished, you should be good to go. You will want to set up the password for the root user. This is your user with full permissions that are used in the MySQL database. You should set a password for the root user so you can ensure that nobody can hack into your database. Go ahead and open the MySQL command prompt so you can set the root user’s password. Run the following commands in SSH:

sudo mysql
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
mysql> FLUSH PRIVILEGES;
mysql> exit

This will set your root password so that you are more secure. You will also want to go in and create a user for yourself, but we will do that later when we set up PHPMyAdmin on your server.

Making Your Server Secure

Even if you aren’t handling passwords, because of browsers nowadays, it is always a good idea to set up HTTPS on your server. This will be the first part of setting up HTTPS on your server. I will show you how to set up certificates later, but we will set it up in its basic form now. First, you will want to execute the following command in SSH:

See also  How to Back up ZFS and Restore Data on FreeBSD

sudo a2enmod rewrite
sudo a2enmod ssl
sudo a2ensite default-ssl

Next, you will want your HTTP site to redirect to your HTTPS site so that people will, by default, connect to your HTTPS server. To do that, type the following command:

sudo nano /etc/apache2/sites-available/000-default.conf

Once you have done that, a text editor will pop up. Type the following information into the text editor:


<VirtualHost *:80>
ServerAdmin [YOUR EMAIL]
DocumentRoot /var/www/html
ServerName [YOUR SITE].com
ServerAlias www.[YOUR SITE].com
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} = [YOUR SITE].com
RewriteCond %{SERVER_NAME} = www.[YOUR SITE].com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanant] </VirtualHost>

This will redirect the HTTP website to the HTTPS website. This ensures that people who log into the site are connecting over a secure connection so that their passwords and other personal information are not readable by hackers. However, there is something else that is needed to ensure the site’s security, and that is an HTTPS certificate. We will look over that later. Now, it is time to register your domain name.

Setting Up Your Domain Name

Google Logo
The Google Logo

Currently, logging into your site is a somewhat tricky process. It requires remembering the website’s IP address, which is a tough thing to do. For people to remember how to access your site. You will want a proper, rememberable name like infotoast.org so people can remember how to access your site.

To do that, you will have to pay a little bit of money. It is usually a monthly payment, and the amount per month will depend on how easy the domain is to remember. I recommend registering your domain via Google Domains. This will also allow you to have Google Apps for your business, which is a necessity for many websites. Infotoast.org is registered with Google Domains. Head over to domains.google to register your domain.

See also  PubHole -- Secure DoH Server with AdBlock and OpenNIC

Setting Up Cloudflare

Cloudflare Logo
The Cloudflare Logo

Cloudflare is your first line of defense to prevent you from getting hacked. You can get a basic version of Cloudflare for free, and all you have to do is plug in your domain name. To get Cloudflare, go to cloudflare.com and sign up using the Wizard. Then, change your DNS servers to Cloudflare, and you will be protected. It’s just that easy. Then, go through each of the tabs and change your settings to how you wish them to be. You will want to set up SSL for Cloudflare to grant you a certificate. You now have a website with all the necessary security measures in place. I will have a later tutorial on how to set up WordPress to build your site.

Similar Posts

One Comment

  1. Pingback: How to Install Wordpress on An Apache Server « Info Toast

Leave a Reply

Your email address will not be published. Required fields are marked *