Skip to main content

Adding SSL wildcard certificate to Ubuntu running Nginx

Adding an SSL wildcard certificate to an Ubuntu server involves several steps.  A wildcard certificate can secure subdomains of a domain with a single certificate. Here's a general outline of the process:

I'll be using an existing wildcard certificate.

sudo apt update && sudo apt upgrade -y

 

ckan.ini issues

Focusing on the ckan.ini file (/etc/ckan/default/ckan.ini).  When I run the commands to recreate the database tables for CKAN:

cd /usr/lib/ckan/default/src/ckan
ckan -c /etc/ckan/default/ckan.ini db init

The response I'm getting is:

server 500 error - 'Internal server error' on Nginx

Finding the issue with a server 500 error

The Nginx error logs are showing too much detail.

 

Nginx logs and test

There are no errors in the nginx log and sudo nginx -t looks fine

sudo nginx -t

Response

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

 

Listening to services running that use port 80

Listen in on the ports being used on your server.  To do so, run the command

netstat -a | grep tcp

If netstat is not install, then you'll be prompted to run the install script

sudo apt install net-tools

Response

How to set up password authentication with Nginx on Ubuntu 20.04

Goal: Restrict content access through username and password entry on an Nginx server.

1: Apache Utilities Package

First, update your server’s package index:

sudo apt update

Check if the utilities package exists in your environment by executing the command

dpkg --get-selections | grep apache

Response:

Run Drupal 9 with Composer + Docker-compose + Nginx + MariaDB + PHP8.1

Running Docker

Dangerous word... I'm assuming that Docker is installed.  Don't know how to check?  Using Terminal (I prefer iTerm2), run the following command

docker -D info

 

The set-up

Go to your project directory, and create a docker folder and a “docker-compose.yml” file:

Configure Nginx SSL + force HTTP to redirect to https and force non-www to www using Nginx configuration file only

Forcing https and www or non-www is a process that I was a custom to through .htaccess.  In fact I had become very strong at managing and working my .htaccess files.  However, what I had become strong in one area, I was oblivious to using other methods.  My bad.

Well that was until I had to change my way.  Working on an Nginx server, .htaccess was not in play.  Instead, I needed to configure the /etc/nginx/sites-available directory.

Nginx: 413 – Request Entity Too Large Error and Solution

Working in Drupal 9.x, I was loading images via the Media module.  Below 1 mb no issue.  Any thing over - nothing.  Nothing as in no response when loading.

An interesting situation, as I had already changed the php.ini file where the following updates occured:

; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 2M

Had changed to 

upload_max_filesize = 10M

Also the post max size

Subscribe to Nginx