New Project Alert: JustLess

My childhood friend, Rita contacted me on IG about a project we could work on. I really liked the idea so I said why not!

I can’t believe jumping headfirst with this project. Domain is set. SSL set. Theme ready to be installed and set up. Lets see how this goes.

This time I’m not overthinking or worrying about building the perfect system. The goal is to start and evolve. I look forward to this

I will give project updates soon and tell you how we came up with the name and other fun stuff.

See project here JustLess (coming soon)

Featured Photo by Erik Mclean from Pexels

Sarai: Project Update 1

It’s been months since I uploaded Sarai. I have not made any major updates to the app. I guess I am overwhelmed by events but that is not an excuse.

Maybe I need to stop beating myself up cause I already do too much for one person (frontend, backend, graphics…whew!)

Task lists includes: posting articles (sarai guides), design posters and reach out to doctors, nurses and midwives.

That aside, frontend needs major updates (social media links should be added to profiles). … Yeah and user sign up ūüôā

Honestly I appreciate my journey more. My mistakes, tears and failures have built my character. In the past I would feel sad that things are not moving the way I planned but now I know better.

If you are reading this, please check out the web app: saraiapp.com and if you know any doctor, nurse or midwife, please refer them to the forms here. Thank you

Featured Image by bongkarn thanyakij from Pexels

Setting Up Comodo Positive SSL On NGIX

If I say this was easy, I’d be lying. I cannot find the right words to express my joy ’cause this whole process was indeed frustrating! I’ll take you through the steps I took, my mistakes and how I solved them.

So let’s get started!

NOTE: this is my first time setting up SSL on NGINX ūüôā and please read through before you proceed to purchase and set up SSL.

Prerequisites

  1. Ensure you’ve installed and set up nginx
  2. Lots of PATIENCE

PURCHASE COMODO POSITIVE SSL

You may decide to buy directly from Comodo or any reseller. In my case, I purchased via Hostinger.

SET UP COMODO POSITIVE SSL

Depending on the provider, you should see this on your dashboard. Click on set up and fill in the details. 

NOTE: you should have this email: admin@yourdomain.com. 

If you do not have ‘admin@domain.com’, purchase email hosting plan from your provider. Luckily I had free business email waiting to be setup….yay!

Once complete, login to the custom email you’ve created. You should get an email containing a validation code. Copy, then click the link provided in the email and paste it there.

DOWNLOAD SSL CERTIFICATE

If all goes well, you should be able to download your SSL certificate. You’ll find it in two places:

  1. Inbox (email address used to register for hosting account)
  2. SSL certificates page on cpanel (in my case hpanel – hostinger)

I’d advise you to download number two. You’ll see why below

 

SET UP SSL CERTIFICATE ON NGINX

I followed this tutorial¬†from Comodo and things got messy from here. So let’s go through the process (mistakes + solution).

Based on this tutorial I should have generated the private key and CSR (certificate signing request) before purchasing SSL but I didn’t.

1 РCreate a directory 

Login to your server via the command line. Decide where you want to store your files and create a directory there.

 

sudo mkdir /your/desired/path/new_directory_name

Run this command in that directory

 

openssl req -new -newkey rsa:2048 -nodes -keyout domainname_com.key 
-out domainname_com.csr

You should get a prompt with a series of questions, fill in with the appropriate answers. Ensure you use your domain name or public ip for the ‘Common Name’ question.

 

Common Name (e.g. server FQDN or YOUR name) []: your_domain.com

 

You’ll get two files: domainname_com.key and domainname_com.csr

Based of another tutorial on youtube, I ran this command instead:

sudo openssl req -new -newkey rsa:2048 -nodes -keyout domain_com.key

-out domain.com

Once questions are completed, I got the csr output:

—–BEGIN CERTIFICATE REQUEST—–

—–END CERTIFICATE REQUEST—–

Copy and create a new file with this command:

 

sudo vim domain_com.csr

 

Enter insert mode by pressing ‘i’. Paste the csr. ‘Esc’ to exit insert mode then :wq to save and quit.

 

CREATE BUNDLE FILES

Combine the crt files extracted from the zip folder into a single file. You can do this by using a GUI text editor. Create a blank file then copy and paste each .crt file in this order:

  1. yourdomain_com.crt
  2. SectigoRSADomainValidationSecureServer.crt
  3. USERTrustRSAAddTrustCA.crt
  4. AddTrustExternalCARoot.crt

Copy everything.

Return to your command line, ‘cd’ into the directory where you stored your key and csr file. Create a new file with this command

 

sudo vim domain_com.crt

Copy and paste.

Save and quit

 

CONFIGURE NGINX

Find server config settings here:

 

/etc/nginx/sites-available/default OR /etc/nginx/sites-available/yoursite

 

If you’re using the default config file, then run this command:


sudo vim /etc/nginx/sites-available/default

 

Scroll through the config file and make these changes:

 

Uncomment this (remove #): listen 443 ssl default_server;

Modify:  server _; to server yourwebsite.com;

<Add the location to your crt and key files>

ssl_certificate /etc/path/to/your/ssl/certificate.crt;

ssl_certificate_key /etc/path/to/your/ssl/privatekey.key;

 

NOTE: terminate each line with a semi colon.

 

Config file should have these changes:

 

listen 443 ssl default_server;

server yourdomain.com;

ssl_certificate /etc/path/to/your/ssl/certificate.crt;

ssl_certificate_key /etc/path/to/your/ssl/privatekey.key;

 

Save and quit.

 

Restart nginx with this command:



sudo service nginx restart

 

Now this is where I got an error:

Job for nginx.service failed because the control process exited with error code.

See “systemctl status nginx.service” and “journalctl -xe” for details.

 

I ran this command to test nginx configuration:

 

nginx -t

 

First error had to do with permission on the key. So I  changed ownership of the .key file to the user signed in.

 

Then restarted the server but another error:

 

… (SSL: error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch)

 

This time private key value mismatch. 

 

After reading numerous articles and watching several youtube videos, I couldn’t find a solution. Mainly because some tutorials are outdated and the one on comodo is helpful to a certain point.

 

THE FIX

Remember the zip file I downloaded from Hostinger dashboard? It contains the private key *facepalm*.

Open the key file in your favorite (gui) text editor. It should be like this:

—–BEGIN PRIVATE KEY—–

..

..

—–END PRIVATE KEY—–

 

Copy it. 

Edit the domain_com.key file with this command

 

sudo vim domain_com.key

 

I deleted everything in the file with ‘:1, $d’ then pasted the new key.

 

Restarted nginx once more and no errors! YES!

 

BROWSER TEST

Type in: https://www.yourdomain.com on your browser’s address bar. If all goes well, you should see a green (closed) padlock.

 

BONUS: REDIRECT HTTP – HTTPS

To do this, you’ll need two server blocks in your configuration file. One for port 80 and the other for 443.¬†

 Modified Server Configuration
server {

listen 80;

listen [::]:80;

server_name domain.com www.domain.com;

return 301 https://$server_name$request_uri;

}

server{


listen 443 ssl default_server;

listen [::]:443 ssl default_server;
 
root /path/to/your/site/folder/public;

server_name domain.com www.domain.com;

ssl_certificate /path/to/domain_com.crt;

ssl_certificate_key /path/to/domain_com.key;


}





FINAL THOUGHTS

This is my first written guide (of some sort) so pardon any errors or mixup. If you have any issues/corrections, do not hesitate to reach out.

Based on one or two, all I had to do was download the zip file containing the private key. Bundle the 4 certificate files and move them to my server.

I’ll work on creating a detailed step by step tutorial as soon as I can (heaven forbid procrastination).

 

Thank you ūüôā

QUICK COMMANDS

 

mkdir somename = make directory

vim hello.extension = create a file named hello. Example hello.txt

sudo chown -R  yourusername foldernameORfilename = change ownership

sudo service nginx restart = restart nginx

sudo systemctl restart nginx = restart nginx

ll = get information about files and directories  (present working directory)

cd  = change directory

Vim

i = insert

:q = quit without saving

:wq = save and quit

:1,$d = delete everything

 

USEFUL LINKs

Coder’s Tape Laravel deployment guide

Digital Ocean – Create SSL certificate for nginx

Comodo Positive SSL on Nginx guide

Digital Ocean – Community Question force HTTP to redirect to HTTPs

Servers for hackers – Redirect HTTP to HTTPs

 

Featured Image via Pexels. Created by Pixabay

Tech Diary: The Almighty Javascript and Django

After many months… err years of procrastinating and avoiding it, I have to admit, I HAVE to learn Javascript! I’ve watched some videos on youtube and it’s making sense now or is it? Hummmn

Yesterday (1 July 2019), for some strange reason I got the urge to learn Django but I’ve never programmed with python before. I watched a couple of crash courses on youtube. I won’t lie… I was a bit bored cause I understood the basic concepts of programming (loops, arrays, variables, constants, etc.) and all I needed was to understand Python Syntax.

I managed to build a simple project in Django, everything looks good. I’ve been working with Laravel so everything feels a little strange and confusing but it’s to early to make comparisons. I’ll dive into another tutorial and I’ll update this post regularly.

I wanted to share the tutorials I’ve been watching (I will add notes under each link). I hope this helps you on your Javascript and Django journey. Goodluck

JAVASCRIPT TUTS

 

FREE: JavaScript Tutorial for Beginners By Academind

Notes: About 1+ hr long. Really helpful. Must watch. Please note that I did not use JSBin like he did, you can learn using any text editor  IDE on your computer. (I used Visual Studio Code)

FREE: Javascript Tutorial By Telusko.

Notes: I love this series!. Do watch this if you want to learn javascript. More updates coming soon

 

PREMIUM

PYTHON & DJANGO TUTS

 

 

FREE: Python for everybody. A full course with Dr. Chuck

Notes: detailed and I enjoyed the way the course was broken down. It’s 13 hours long so feel free to skip to the important parts. I’ve bookmarked this for future purposes!

 

FREE: Python Tutorials By Mike Dane

Notes: Another amazing tutorial. This was the first one I watched (on python). Mike breaks things down which is useful if you’re a beginner programmer. The main tutorial I watched was about 4hours long on FreeCodeCamp Youtube Channel. It had about 7+ million views. I wanted to reference to Mike’s own channel but you can watch the compiled version here on freecodecamp.

 

FREE: Python Django Tutorial: Full-Featured Web App by Corey Schafer

Notes: Based on the comments the tutorial seems GOOD. Updates coming Soooooon….

 

PREMIUM: Create a web application with python + Django + PostgreSQL

Notes: I would recommend this tutorial if you’re an absolute beginner. If you’re an advanced programmer but you want to learn django, this might be somewhat slow ‘paced’ for you but it’s worth it.¬†

When you upload images, you might get a broken link. Do not panic like I did (searching through stack overflow and asking myself if this was really worth it). Finish the course, in the last 2 or 3 videos you should define your MEDIA_URL and MEDIA_ROOT. Once this is done, head on to your admin panel and upload data to your course model. Now your image(s) will show (no more broken links)…

 

PREMIUM: Django for Beginners РBuild Web Application With Python!

Notes: I’m just starting with this course. Updates coming soon…

 

 

Featured image source: Pexels