Create your own self-hosted website

July 5, 2023 0 Comments

To set up my cybersecurity projects portfolio, I needed to create a website and find a cost-effective way to make it accessible online. Rather than outsourcing the task, I saw this as an opportunity to learn and take on the challenge myself. Additionally, I wanted to share my experience with others who might be interested in doing the same. The best part is that this process can be completed relatively quickly, without relying on external assistance.

Now, let me guide you through the step-by-step process of creating your own self-hosted website, ensuring both speed and security. Let’s begin!

Sign up with Digital Ocean


Start by opening an account with Digital Ocean, a provider offering various cloud-based products and services. Go to their website (https://www.digitalocean.com/) and create and log in to your account.

Create a Project


Once you’re in, create a new project by clicking ‘+ New Project’ in the left-hand menu. Give your project a name and description, then select ‘Create Project.’ You can choose to ‘Skip for now’ if prompted to move resources into your project.

Set Up a Droplet


In the ‘Resources’ tab, select the option to ‘Spin up a Droplet.’

Choose a Region and Datacenter that suits your location.

Next, scroll down to the ‘Choose an image’ section and select the ‘Marketplace’ tab. Choose ‘WordPress’ from the available options.

Then for hardware, we’re going with the smallest and cheapest available.

For security purposes, it’s recommended to use SSH keys for login, but if you prefer a password, make sure it is strong and secure (16 characters MINIMUM and must NOT BE COMMON). If you opt for SSH keys, click ‘New SSH Key’ to set it up.

Follow the provided instructions for creating a new key pair, add the public key, give it a name, and select ‘Add SSH Key’ to complete the process. Using SSH keys will allow remote login to your virtual machine.

Finalize the setup by adding a Hostname and then clicking ‘Create Droplet.’

Within a minute or so, your new Droplet will be up and running, providing you with its IP address. This Droplet will host your new website, and the IP address will enable users to access it. Note down the IP address for later use.

Purchase a Domain


While the IP address is technically enough for people to visit your site, it’s more user-friendly to have a domain name. To obtain one, you’ll need to purchase a domain from a registrar. For this example, I’ll use https://www.namecheap.com/, but you can choose any other domain registrar. Create an account and log in. Navigate to ‘Domains’ in the top menu, then select ‘Domain Name Search.’ Enter your desired website name in the search bar and click ‘Search’ to check availability.

Choose the domain and top-level domain (e.g., .com, .org) you want and add it to your cart for checkout.

After purchasing the domain, select ‘Manage’ to begin configuration.

Configure the Domain

Make sure you are in the ‘Domain List’ section on the left menu and then choose ‘Advanced DNS.’

Delete any existing records and create two new ones:

‘A’ record: Use the ‘@’ symbol as the Host and enter the IP address of your Digital Ocean Droplet as the Value. This step associates your IP address with the domain name, enabling users to reach your website by entering the domain name.
‘CNAME’ record: For the Host, use ‘www’ and for the Value, enter the domain name you just purchased. This step allows you to link subdomains or domains to one another.
Leave TTL as automatic for both records and save the changes. It may take some time for the new DNS records to propagate across all DNS servers on the internet.

Install WordPress on Your Droplet


Accessing your Digital Ocean server is simple. Open a terminal and SSH into your server using the SSH Key you set up earlier.

Digital Ocean’s script will guide you through the installation process, including entering the domain name you purchased and providing your email address. It will also ask you to create a username and password to access the WordPress server’s back end, where you can make updates and edits to your site. Ensure you use a strong password to safeguard against unauthorized access attempts.

Additionally, you can create a title for your website during this process. Once you’re satisfied, confirm and continue.

Configure SSL


The script will assist you in obtaining a real SSL certificate to encrypt internet traffic and verify your server’s identity. SSL certificates are indicated by ‘https’ in the URL bar, providing assurance that data submitted to your website is secure.

To configure SSL, select ‘Y’ when prompted, and enter your email address to receive security alerts and renewal notices related to your SSL certificate. Review the terms of service, agree to them, and proceed.

The script should automatically populate the names for which you want to activate ‘HTTPS’ with the ones you set in the ‘A’ and ‘CNAME’ records earlier. Press enter to continue. If everything is set up correctly, it should work seamlessly. If you encounter any errors, double-check your DNS records and try again.

Once the process is successful, you’ll see a confirmation screen. When you visit your website using your web browser, you should see a lock symbol in the address bar, indicating that the site is encrypted.

Login to WordPress


Now, you can access the WordPress back end and start customizing your site. Add ‘wp-admin’ to your website address (e.g., https://yourwebsite.com/wp-admin) to reach the login page. Enter the login credentials you created during the server setup to access the Dashboard, where you can manage your site.

Once you login successfully you will reach the Dashboard area which will look like the following image. As an additional security measure, consider activating the WP fail2ban plugin, which offers various security features. You can find the plugin section in the left-hand menu.

Moreover, take advantage of the free themes offered by WordPress to quickly customize your website’s appearance. Navigate to ‘Appearance → Themes,’ select ‘Add New Theme,’ and choose a theme that suits your style. Once activated, you can start editing your site to make it your own.

One thought on “Create your own self-hosted website”

Leave a Reply

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