How To Configure Varnish Cache with Apache Reverse Proxy and SSL Termination

Based on site: PlumRocket

In this guide, we will show you how to install and configure the Varnish cache for the Apache webserver with SSL termination. One limitation of Varnish Cache is that it is designed to accelerate HTTP, not the secure HTTPS protocol. Therefore, some workarounds must be performed to allow Varnish to work on SSL enabled website.

SSL/TLS Termination is the process of decrypting SSL-encrypted traffic. In our case, Apache acts like a proxy server and intermediary point between the client and Varnish and is used to convert HTTPS to HTTP.

apache_varnish

Step 1. Install and Configure Apache (Backend) on CentOS/RHEL 8

We had CentOS 8 installed on our web server, which uses dnf package manager. However, if you are familiar with Linux systems, you can apply this manual almost entirely to other OS, such as Centos 7 (use yum) or Ubuntu and Debian (use apt instead).

How to install Wiki.js on Ubuntu 22.04

This guide is a fully detailed guide to install everything necessary to run Wiki.js on a brand new Ubuntu 18.04 / 20.04 / 22.04 LTS machine.

What's Included

At the end of the guide, you'll have a fully working Wiki.js instance with the following components:

  • Docker
  • PostgreSQL 11 (dockerized)
  • Wiki.js 2.x (dockerized, accessible via port 80)
  • Wiki.js Update Companion (dockerized)
  • OpenSSH with UFW Firewall preconfigured for SSH, HTTP and HTTPS

Update Ubuntu

sudo apt -qqy update

sudo DEBIAN_FRONTEND=noninteractive apt-get -qqy -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' dist-upgrade

Install Docker

Raspberry PI Pico W motion and light sensor relay

At first I thought I would need to use a PI Pico to control a automatic light in my garage.  I started off by buying the following, but then I learned that just the RCWL-0516 Switch Module could do it all without the need for the PI Pico.

Radar Sensor RCWL-0516 Switch Module

Songhe RCWL-0516 RCWL0516 Microwave Radar Sensor Module,Human Body Induction Switch Module,Motion Induction Switch Sensor Module 5-7m 4-28V 5pcs

At CDS you can add a LDR (light-dependent resistor) to do motion detection during night only. For example, if you need to use this module for motion sensing light for outdoor, then LDR is a must. Without LDR light will glow in daytime also which is the waste of electricity.

(details here)

Amazon 8 pcs for $9.59

 RCWL-0516

 

Resistor 5516 GL5516 5mm 0.5 Mohm Photoresistor

Chanzon 20pcs LDR Resistor 5516 GL5516 5mm 0.5 Mohm Photoresistor Light-Dependent Photoconductor 20pcs Photo Light Sensitive

(details here)

Program to raise blinds - up.py

# up.py  python3 program to raise blinds

import time
import RPi.GPIO as GPIO
import sys
import shutil
from os.path import exists

channel1 = 17   # motor left
channel2 = 27   # motor right
channel3 = 22   # power switch
traveltime = 86

upfile = '/home/pi/shade/up.status'        # existance of this files means blinds are currently up
downfile = '/home/pi/shade/down.status'    # existance of this files means blinds are currently down
raisefile = '/home/pi/shade/raise.status'  # existance of this files means blinds were partly raised
lowerfile = '/home/pi/shade/lower.status'  # existance of this files means blinds were partly lowered
stopfile = '/home/pi/shade/stop.status'    # existance of this files means disable movement of blinds (windy)

stopfile_exists = exists(stopfile)
upfile_exists = exists(upfile)
downfile_exists = exists(downfile)

# if on vacation or windy a stopfile prevents program running
if ( stopfile_exists):
    sys.exit('Warning cannot raise blind because of stopfile at: /home/pi/shade/stop.status')

if (not downfile_exists):
    sys.exit('Error cannot raise blind that is up: /home/pi/shade/down.status')

shutil.move(downfile, raisefile)
sys.stdout.write ('raise ')

#GPIO setup
GPIO.setmode(GPIO.BCM)
GPIO.setup(channel1, GPIO.OUT)
GPIO.setup(channel2, GPIO.OUT)
GPIO.setup(channel3, GPIO.OUT)

def motor_off(pin):
    GPIO.output(pin, GPIO.HIGH)  # Turn on

Program to lower Blind - Down.py



# Program down.py
# python3 down.py
import time
import RPi.GPIO as GPIO
import sys
import shutil
from os.path import exists

channel1 = 17   # motor left 
channel2 = 27   # motor right 
channel3 = 22   # power switch 
traveltime = 86 # number of seconds to move blind

upfile = '/home/pi/shade/up.status'        # existance means blinds are currently up 
downfile = '/home/pi/shade/down.status'    # existance means blinds are currently down 
raisefile = '/home/pi/shade/raise.status'  # existance means blinds were partly raised 
lowerfile = '/home/pi/shade/lower.status'  # existance means blinds were partly lowered 
stopfile = '/home/pi/shade/stop.status'    # existance means disable movement of blinds (windy)

stopfile_exists = exists(stopfile)
upfile_exists = exists(upfile)
downfile_exists = exists(downfile)

if ( stopfile_exists):
        sys.exit('Warning cannot lower blind because of stopfile at: /home/pi/shade/stop.status')

if (not upfile_exists):
    sys.exit('Error cannot lower blind that is not up: /home/pi/shade/up.status')

sys.stdout.write ('lower ')
shutil.move(upfile, lowerfile )

#GPIO setup
GPIO.setmode(GPIO.BCM)
GPIO.setup(channel1, GPIO.OUT)
GPIO.setup(channel2, GPIO.OUT)
GPIO.setup(channel3, GPIO.OUT)

def motor_off(pin):
    GPIO.output(pin, GPIO.HIGH)  # Turn on
    print ("off")

def motor_on(pin):
    GPIO.output(pin, GPIO.LOW)  # Turn off
    print 

Ubuntu - The following packages have unmet dependencies:  nvidia-driver-515 : Depends:

Cura gives Could not probe OpenGL. This program rquires OpenGL 2.0 or higher.

 

I just dealt with the same issue on Ubuntu 22.04 when trying to install

$ sudo ubuntu-drivers autoinstall
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

Linux Commands with examples

cp

Copy file1 to file2 preserving the mode, ownership and timestamp.

  $ cp -p file1 file2

mv

Rename file1 to file2. if file2 exists prompt for confirmation before overwritting it.

  $ mv -i file1 file2

rm

get confirmation before removing the file.

  $ rm -i file*

cd

change directory.

  $ cd path

change back to previous directory

  $ cd -

pwd

Print working directory, shows the path of the current directory

  $ pwd

more

Echo the contents of the file to the screen one page at a time, see also less and cat

  $ more /opt/example/file.txt

ls

Display filesize in human readable format (e.g. KB, MB etc.,)