How Do You Set up Nginx to Be a Reverse Proxy That Conveys Inbound Connections to the Web Server with the Fewest Active Connections?

Problem scenario
You want your website to perform well.  By default Nginx’s load balancing system uses the round-robin technique.  You want available yet under-utilized web servers to handle inbound connection requests (aka someone using a web browser to go to a web page).  Individual users can put a disparate load on a given Nginx instance.  Some website users will spend a significant amount of time on a web page.  Others will invoke various application features that will require more resources than others. 

How Do You Use the C++ Connector for Libpqxx?

Problem scenario
You want to integrate C++ programs with Postgresql on an Ubuntu instance of AWS.  You want to use pqxx (http://pqxx.org/development/libpqxx/) as it is an API connector for C++ to Postgres.  How do you use libqxx?

Solution
#1  Install Postgresql.  To install Postgresql, run this as root or with a “sudo ” in front of it: apt-get install postgresql

#2  To execute SQL commands,

How Do You Install pqxx on an AWS Instance of Ubuntu?

Problem scenario
You try to compile a C++ program (i.e., a .cpp file).  You get this message:  “fatal error:  pqxx/pqxx: No such file or directory.”  You want to install pqxx on your Ubuntu server in AWS.  What do you do?

Solution
#1  Log into the server.  Run this command as root or with a sudo in front it:

add-apt-repository ppa:jtv/ppa 
#Press enter in response to the prompt from the command above.

How Do You Find the Version of Postgres without Running a SQL Command?

Problem scenario
To find the version of Postgres when you can enter the SQL database, you would run this SQL command with no quotes: “SELECT version();”

In this situation you cannot enter the Postgres database (and therefore can run no SQL commands).  You want to know more about the installation of Postgres to troubleshoot why you cannot enter it.  How do you find the version of Postgresql that is installed?

How Do You Install Docker on an AWS Instance of Ubuntu?

Problem scenario
You want to install Docker on an AWS instance of Ubuntu.  But you do not know how.  How can you quickly do this?

Solution
Run these two commands:
sudo apt-get -y update
sudo apt -y install docker.io

An alternative set of directions is here.  For a variety of different directions for all different types of Linux,

Using Ubuntu, How Do You Install a C++ Compiler and Run a Basic C++ Program?

Problem scenario
You want to install a C++ compiler in Ubuntu.  You want to write a basic C++ program and run it.  How do you do these things?

Solution
1. As root, install a C++ compiler with this command:

apt install g++

2. Create a basic program.  Here is an example.  Name this file hello.cpp and put this as the content:

#include <iostream>

How Do You Deploy Docker to Ubuntu Linux Servers Using Puppet?

Problem scenario
You want to deploy Docker to Ubuntu Linux using Puppet.  How do you write a manifest to install Docker an Ubuntu server?

Solution
This solution demonstrates transferring a file with Puppet.  

1.  Install Puppet master on an Ubuntu Server.  See this link if you want directions.
2.  Install Puppet agent on a different Ubuntu server.  See this 

How Do You Deploy Docker to RedHat Linux Servers Using Puppet?

Problem scenario
You want to use Puppet to deploy Docker to a RHEL server in AWS.  How do you do this?

Solution
Warning: This may not work for Puppet versions 5 or higher. It should work for Puppet version 4 or lower. This solution is not a best practice.  It is quick way to deploy a version of Docker made for CentOS to RHEL instances.