Latest posts

Browse topics

How To HTTPS Secure Drupal 8 Running Nginx with Let's Encrypt on Ubuntu 18.04

Let's Encrypt have done some very good job, providing SSL certificates that everyone can use absolutely for free. Encrypted HTTPS websites should be default in 2020.

I have been implementing HTTPS secure websites for years. Until now I mostly worked with Drupal 7 websites and for securing them I have been using this guide, back from 2016 - Linode: How To Secure Nginx with Let's Encrypt on Ubuntu 12.04

Now, in 2020, working on a new, Drupal 8 powered, website after then initial web development was completed,  I was looking for an easy way to implement a free SSL certificate from Let's Encrypt.

And here comes this tutorial from Digital Ocean in help: How To Secure Nginx with Let's Encrypt on Ubuntu 18.04

 in 2020, installing, obtaining and renewing an SSL certificate is much easier than it was back in 2016

Before proceeding, make sure you have installed Drupal 8 with Nginix on Ubuntu 18.04,

Non securre Drupal 8 website

Non secure Drupal 8 website

Step 1: Installing Certbot

The first step to using Let’s Encrypt to obtain an SSL certificate is to install the Certbot software on your server.

Certbot is in very active development, so the Certbot packages provided by Ubuntu tend to be outdated. However, the Certbot developers maintain a Ubuntu software repository with up-to-date versions, so we’ll use that repository instead.

First, add the repository:

sudo add-apt-repository ppa:certbot/certbot

You’ll need to press ENTER to accept.

Install Certbot’s Nginx package with apt:

sudo apt install python-certbot-nginx

Certbot is now ready to use, but in order for it to configure SSL for Nginx, we need to verify some of Nginx’s configuration.

Step 2: Obtaining an SSL Certificate

Certbot provides a variety of ways to obtain SSL certificates through plugins. The Nginx plugin will take care of reconfiguring Nginx and reloading the config whenever necessary. To use this plugin, type the following:

sudo certbot --nginx -d optionsbrew.com

This runs certbot with the --nginx plugin, using -d to specify the names we’d like the certificate to be valid for.

If this is your first time running certbot, you will be prompted to enter an email address and agree to the terms of service. After doing so, certbot will communicate with the Let’s Encrypt server, then run a challenge to verify that you control the domain you’re requesting a certificate for.

If that’s successful, certbot will ask how you’d like to configure your HTTPS settings.

Configuring certbot

Select your choice then hit ENTER. The configuration will be updated, and Nginx will reload to pick up the new settings. certbot will wrap up with a message telling you the process was successful and where your certificates are stored:

Your certificates are downloaded, installed, and loaded. Try reloading your website using https:// and notice your browser’s security indicator. It should indicate that the site is properly secured,

Secure HTTPS Drupal 8 site

Secure HTTPS Drupal 8 site

Step 3: Verifying Certbot Auto-Renewal

Let’s Encrypt’s certificates are only valid for ninety days. This is to encourage users to automate their certificate renewal process. The certbot package we installed takes care of this for us by adding a renew script to /etc/cron.d. This script runs twice a day and will automatically renew any certificate that’s within thirty days of expiration.

To test the renewal process, you can do a dry run with certbot:

sudo certbot renew --dry-run

If you see no errors, you’re all set. When necessary, Certbot will renew your certificates and reload Nginx to pick up the changes. If the automated renewal process ever fails, Let’s Encrypt will send a message to the email you specified, warning you when your certificate is about to expire.

How to Install Drupal 8 with Nginx, PHP-FPM 7.2, MySQL, phpMyAdmin on Ubuntu 18.04 - Linode Guide

In this article, you will learn how to setup Drupal 8 with Nginx, PHP-FPM 7.2, MySQL and phpMyAdmin on Ubuntu 18.04

For the following tutorial, I used very much the information from my previous guide with Ubuntu 16.04, but decided to rewrite it for Ubuntu 18.04 version as when I tried to setup my latest project about stock trading 0dtespxtrading.com  with Drupal 8.8.5  on Ubunut 16.04 machine an error from Drupal that PHP version shipped with Ubuntu 16.04   was outdated and instead of upgrading that box I decided to go with a new server from scratch, 

Prerequisites

  • Ubuntu 18.04 
  • Root privileges.

You can get a cheap VPS starting just $5/mo from Linode. That's what I did - bought a new nanode from Linode

Deploying server with Linode

Deploying server with Linode

Literally in couple of seconds the new server was up and running - that's what I love sticking with Linode for years

Follow basic security guide, see: Securing Your Server

I will use Putty for Windows to access SSH

Secure your server

Create the user, replacing example_user with your desired username. You’ll then be asked to assign the user a password:

adduser example_user


Add the user to the sudo group so you’ll have administrative privileges:

adduser example_user sudo

Disallow root logins over SSH. This requires all SSH connections be by non-root users. Once a limited user account is connected, administrative privileges are accessible either by using sudo or changing to a root shell using su -.

sudo nano /etc/ssh/sshd_config

Under # Authetification section change to

# Authentication: ...

PermitRootLogin no

Update the Ubuntu system

sudo apt-get update

Install Nginx and PHP-FPM

Install Nginx with the following apt command:

sudo apt-get install nginx -y

Next, install php7.0-fpm with php-gd extension that is required by Drupal core:

sudo apt-get install php7.2-fpm php7.2-cli php7.2-gd php7.2-mysql php7.2-xml -y

Configure Nginx and PHP-FPM

In this step, we will configure Nginx to use php-fpm to serve HTTP requests for PHP pages. Go to the php-fpm directory "/etc/php/7.0/fpm" and edit the "php.ini" file:

sudo nano /etc/php/7.2/fpm/php.ini

Un-comment the cgi.fix_pathinfo line and change the value to "0"

When using nano command you can use CTRL+W to locate that line. Once changed press CTRL+O to save changes and CTRL+X to exit from nano editor

Now we should modify the default Nginx virtual host configuration. Edit the "default" file and enable the php-fpm directive.

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

Un-comment  location ~ \.php$ section, so it look like this

location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php7.0-cgi alone:
#fastcgi_pass 127.0.0.1:9000;
# With php7.0-fpm:
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}

CTRL+O and CTRL+X

Then test the Nginx configuration with the command "nginx -t" to ensure that it is valid:

nginx -t

If there is no error, restart nginx and the php-fpm service:

systemctl restart nginx
systemctl restart php7.2-fpm

PHP Info file (Optional)

Next, test that php-fpm is working properly with nginx by creating new php info file in the web directory "/var/www/html"

cd /var/www/html/
echo "<?php phpinfo(); ?>" > info.php

Visit the info.php file at the server IP  in a web browser.

Configure the VirtualHost for Drupal

We will install Drupal 8 in the directory "/srv/www/0dtespxtrading.com". Please replace my domain name in your installation with the domain name of the website that you want to use this Drupal installation for. So let's create the directory:

sudo mkdir -p /srv/www/0dtespxtrading.com/{public_html,logs}
sudo usermod -a -G www-data admin
sudo chown -R www-data:www-data /srv/www
sudo chmod -R 775 /srv/www
sudo nano /etc/nginx/sites-available/0dtespxtrading.com

Paste the Nginx configuration for Drupal 8:

server {
    server_name 0dtespxtrading.com;
    root /srv/www/0dtespxtrading.com/public_html; ## <-- Your only path $
    access_log /srv/www/0dtespxtrading.com/logs/access.log;
    error_log /srv/www/0dtespxtrading.com/logs/error.log;

    listen 80;
    listen [::]:80;


    location = /favicon.ico {
        log_not_found off;
        access_log off;
    }

    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }

    # Very rarely should these ever be accessed outside of your lan
    location ~* \.(txt|log)$ {
        allow 192.168.0.0/16;
        deny all;
    }

    location ~ \..*/.*\.php$ {
        return 403;
    }

    location ~ ^/sites/.*/private/ {
        return 403;
    }

    # Block access to "hidden" files and directories whose names begin with a
    # period. This includes directories used by version control systems such
    # as Subversion or Git to store control files.
    location ~ (^|/)\. {
        return 403;
    }

    location / {
        # try_files $uri @rewrite; # For Drupal <= 6
        try_files $uri /index.php?$query_string; # For Drupal >= 7
    }

    location @rewrite {
        rewrite ^/(.*)$ /index.php?q=$1;
    }

    # In Drupal 8, we must also match new paths where the '.php' appears in the middle,
    # such as update.php/selection. The rule we use is strict, and only allows this pattern
    # with the update.php front controller.  This allows legacy path aliases in the form of
    # blog/index.php/legacy-path to continue to route to Drupal nodes. If you do not have
    # any paths like that, then you might prefer to use a laxer rule, such as:
    #   location ~ \.php(/|$) {
    # The laxer rule will continue to work if Drupal uses this new URL pattern with front
    # controllers other than update.php in a future release.
    location ~ '\.php$|^/update.php' {
        fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
        #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
        include fastcgi_params;
        include snippets/fastcgi-php.conf;
        fastcgi_param SCRIPT_FILENAME $request_filename;
        fastcgi_intercept_errors on;
        fastcgi_pass unix:/run/php/php7.2-fpm.sock;
    }

    # Fighting with Styles? This little gem is amazing.
    # location ~ ^/sites/.*/files/imagecache/ { # For Drupal <= 6
    location ~ ^/sites/.*/files/styles/ { # For Drpal >= 7
        try_files $uri @rewrite;
    }

    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
        expires max;
        log_not_found off;
    }
}

CTRL+O and CTRL + X

The Drupal virtual host file has been created, now we have to activate it by creating a symlink to the file in the "sites-enabled" directory:

ln -s /etc/nginx/sites-available/0dtespxtrading.com /etc/nginx/sites-enabled/

Test the Nginx configuration and if there is no errors restart Nginx:

nginx -t
systemctl restart nginx

Install MySQL

sudo apt-get install mysql-server
​sudo mysql_secure_installation

Install phpMyAdmin

sudo apt-get install phpmyadmin

Hit ESC when the installation prompts you for auto-configuration, because there is no option for Nginx.

Make an easy accessible symlink

sudo ln -s /usr/share/phpmyadmin/ /srv/www/reinisfischer.com/public_html/phpmyadmin

​

Install and Configure Drupal

Enter the directory that we created earlier and download Drupal with wget. I'm using the latest Drupal 8.8.7]5. release as of April 23, 2020, make sure you are downloading latest version by visiting Drupal 8 download page and writing down the last numbers (version)

cd /srv/www/0dtespxtrading.com
sudo wget https://ftp.drupal.org/files/projects/drupal-8.8.5.tar.gz
sudo tar -xvzf drupal-8.8.5.tar.gz
sudo cp drupal-8.8.5/* public_html/ -R
sudo chown www-data:www-data public_html -R

Now visit your Drupal site in the web Browser, you should see following screen

Drupal 8 welcome screen

Drupal 8 welcome screen

Now, it's just time to connect database and set up your Drupal 8 website

April 2020 Dividend Income Report - $78.40

Welcome to the thirty-sixth (#36) dividend income report, covering earnings I've made from dividend-paying stocks and peer to peer lending in April 2020.

Last April we spent in a self-isolation (because of Covid-19) here in Georgia. Baby girl is doing her online class, learning about animals, shapes, continents, and even planets. Quite fascinating what a 21-month-old can do. Development is very rapid.

King Davids Tower (s) in Tbilisi

King Davids Tower (s) in Tbilisi

It was on the evening of April 27, 2020, I decided to switch glass (from the kit lens to telephoto) and make some photo for the month of April to put in the description for the monthly dividend income report.

From the perspective of the market, last April was quite good, we recovered some 15% from the lost value, but still are under the water. From the perspective of dividends - this was a complete disaster - most ot the dividends were trimmed, some cut down to 0. Before the World's health crisis is was planned to take about $230 in dividends last April, but we managed to book only $78.40.

That's one of the worst dividend months in years - the sad news, this is not over - it will take many months, if not years to recover.

Compared to the previous April in 2019, that is a decrease of -52.26% (-$85.84)

Options trades helped a little to offset the losses, but also were nothing impressive - I made some money with calls and puts, but lost some money with vertical spreads. At the end of the month, we were able to book $41.33 from options trades. 

For a now I have decided to pause my adventures with crypto options, but I made some $9.28 last month

When counted all together (dividends + options + crypto options), it seems I have made $129.01 in total last month. Effective income yield last April was 0.76% (about 9.12% annually) Which is humble for me, but anything positive in these times is good.

One of my monthly goals is to generate at least 2.5% income yield from a portfolio. Let's see, can I get on the track in the futures months (Spoiler alert - the only way I see this happen is from option trading

Interest income in April 2020

From the stocks and peer to peer lending I got following income last month:

Ticker

Earnings

EDI

€27.26

EDF

€21.33

Mintos

€8.09

RA

€7.81

NCV

€3.88

AWP

€3.76

Total EUR 71.83 / USD 78.40

In total there were 6 companies paying us dividend in April 2020 that 5 companies less than in April 2020

We didn't get payments this April from, NRZ (dividend will be paid in May, but is cut by 90%), PNNT (we still hold the stock, but our stock was sold on div ex-day back in March, so we didn't qualify for a dividend this April, hopefully, things will get better in July.

If things were at the pre-COVID-19, we would collect at least $138.45 from NRZ and PNNT, but we didn't.

Monthly income

I've been tracking my journey towards million dollars in a savings account since January 2017.  More than three years already. The result for 2020 is lagging behind

in 3 out of 4 months this year, the dividend income has been lower than in 2019

Monthly dividend Income chart as of April 2020

Monthly dividend Income chart as of April 2020

The cumulative dividend earnings for 2020 now are $657.55  which is exactly 18.27% from my goal of 2020 ($3,600). On average, it would ask me to generate $367.81 every month for the next 8 months to reach my goal. With 90% confidence, I'm saying this goal won't be reached this year.

2019 in Review and Financial Goals for 2020

Goals for April 2021

This is my favorite part of the reports - trying to forecast/set goals for the next year. But before setting a goal for 2020, let's see what I forecasted/said a year ago (April 2019)

When setting goals for April 2020, I will say I want to increase dividend income by at least $70 - it translates in $234. Let's keep an odd number. I like them. lol

Wow, a total failure. I wasn't' smart enough to build Covid-19 proof dividend portfolio and instead of an increase of $70, we are now experiencing a decrease of more than $80.

When setting goals for 2021 - I will say anything above $200 will be a great result. To get there it will ask a lot of smart investments and a lot of cash deployed

Rundāle Palace and Garden

Rundāle Palace  is one of the two major baroque palaces built for the Dukes of Courland in what is now Latvia, the other being Jelgava Palace. The palace was built in two periods, from 1736 until 1740 and from 1764 until 1768. It is situated at Pilsrundāle, 12 km west of Bauska.

The palace and its garden are among the top 10 destinations to visit in Latvia. 

We have been heading to Rundāle once in a while, when in Latvia, preferably in Summer.

Rundala palace and its garden

Rundala palace and its garden

In 1735 Duke of Courland Ernst Johann von Biron bought land in Rundāle with an old medieval castle in the territory of a planned summer residence. The old castle was demolished and construction after the design of Bartolomeo Rastrelli started in 1736.

Construction proceeded slowly because part of the materials and resources were transferred to the construction of Jelgava Palace, a project which was more important for the duke. Following Biron's fall from grace in 1740, the palace stood unfinished and empty until 1762 when Biron returned from his exile.

Under the supervision of Rastrelli its construction was finished in 1768. Johann Michael Graff produced lavish stucco decorations for the palace during this time. Ernst Johann von Biron loved the palace and moved there already in 1768. He often visited palace and spent summers there until his death in 1772. Son of an Ernst Johann duke Peter von Biron visited palace only a few times because unlike his father he preferred to spend summers in his Vircava manor.

Garden at Rundale place

Garden at Rundale place

The garden is really impressive. It can compete to the famous Keukenhof tulip fields in the Netherlands.

The palace is one of the major tourist destinations in Latvia. It is also used for the accommodation of notable guests, such as the leaders of foreign nations. The palace and the surrounding gardens are now a museum

Guest House Old Wall in Lagodekhi

Offering a barbecue and children's playground, Guest House Old Wall is situated in Lagodekhi.

Property is set within the historic walls of the old castle Lakuasti. Guests can enjoy the on-site bar. Free WiFi is available throughout the property and free private parking is available on site.

This was our first stay in Lagodekhi, during a recent trip to the region (September 2019), we arrived here after a nice and comfy stay at Akhasheni Wine Resort near Gurjaani. 

Guest House Old Wall in Lagodekhi

Guest House Old Wall in Lagodekhi

It was decided to use this guesthouse as a base to reach the Ninoskhevi waterfall. And seems the guest house is one of the top choices for travelers from all around the World to get there.

Rooms feature mountain or garden views. Guests can enjoy traditional Georgian dishes on site.

Interior inside guest house

Interior inside guest house

Nice and cozy. We were offered a duplex room, but as we were traveling with a toddler, we asked to switch our rooms and were presented room in the first floor.

During our one night stay here we met travelers from Germany, Israel. In the evening kid hosts made a supra for us in the outside garden.

Traditional Georgian supra in the evening

Traditional Georgian supra in the evening

Grilled mead, salads and cheese, really good.