How Do You Set up Nginx as an HTTP Load Balancer So Client Requests (from Web Browsers) Do Not Go to Certain Nginx Servers unless Others Are Down?

Problem scenario
You have a web server running Nginx that acts as a reverse proxy server.  On occasion your regular web (Nginx) servers go down.  You want to have one or two web (Nginx) servers that are  reserved as backups exclusively.  You do not want traffic going to these servers unless the main Nginx servers are unavailable (either due to network or server failure).  You can allocate RAM and CPU to these reserved servers on demand. 

How Do You Find the URL of Your Kubernetes Cluster?

Problem scenario
You want to view the website that is powered by Kubernetes. But you do not know which URL to go to. What should you do from the back-end server with kubectl?

Solution

1. Run this: kubectl get services
With the resulting output, find a name that you want the URL for. (Services have names.) Let’s assume the name was “foobar”.

How Do You Get a PHP Script to Invoke a Bash Command?

Problem scenario
You are trying to get a PHP file to invoke a bash script. When you run it from the command line with “php foobar.php” you just see the content of the PHP file. What do you do to get PHP to invoke a bash script?

Solution
Make sure you have the correct header and closing symbols. Here is the content of foobar.php:

<?php
exec(‘bash /var/www/html/testScript.sh’); …

What Should You Do to Set Firefox to Be Your Default Browser in Windows 10?

Problem scenario
When you open Firefox in Windows 10 you get a prompt about whether or not it should be your default browser. You choose the option (“Use Firefox as my default browser”) to make it your default browser, but it does not work. You see a window called “Settings” which has options for default applications.

What should you do to get Firefox to be your default browser in Windows 10?

How Do You Test if a REST API Call Is Reaching a Linux Server?

Problem scenario
You have a Linux server with a web service listening on port 443 (or some other port). You are not sure if another server can reach this Linux server. There could be firewall issues or network problems restricting connectivity on a given port. You have used ping to test connectivity. You have used nmap to verify the port is listening. But you are not 100% sure the REST calls are reaching the intended server on the correct port (e.g.,

How Do You Deactivate a HipChat User with Only His/Her Email Address Using the REST API?

Problem scenario
You have email addresses of users that you want deactivated. You do not want to use the GUI for HipChat. How do you invoke REST APIs to deactivate a user?

Prerequisite
You need an API token for HipChat. If you have this, start with the Procedures below. Otherwise keep reading this “Prerequisite” section. You need several scopes for the API token authorize you to be able to deactivate a user.

How Do You Create a Dockerfile That Will Use Reserved Words Such as FROM, RUN, COPY, WORKDIR, ADD, and LABEL?

Problem scenario
You want to create your own Dockerfile. You also want to invoke reserved words such as FROM, RUN, COPY, WORKDIR, ADD, and LABEL. You want to then create a Docker image from it. You want to ultimately create a working Docker container from that image. How do you do all of this?

Solution

1. In a given directory,

How Do You Troubleshoot the Google Kubernetes Engine error “Request had insufficient authentication scopes”?

Problem scenario
You run a command like this:
gcloud container clusters get-credentials standard-cluster-1 –region us-central1-a

But you receive one of the following messages:
“Fetching cluster endpoint and auth data.
ERROR: (gcloud.container.clusters.get-credentials) ResponseError: code=403, message=Request had insufficient authentication scopes.”

ERROR: (gcloud.projects.describe) User [123456789-compute@developer.gserviceaccount.com] does not have permission to access projects instance [123456789] (or it may not exist): Request had insufficient
authentication scopes.

How Can Nginx Be an HTTP Load Balancer for Apache Web Servers?

Problem scenario
You have an Nginx server that you want to be a traffic distributor to Apache web servers.   What has to be done to configure Nginx’s HTTP load balancing function to relay inbound connection requests to Apache web servers?

Solution
Nothing special has to be done for the web servers.  Nginx can be a reverse proxy to either Nginx web servers or Apache web servers. 

How Do You Troubleshoot the AWS CLI Error Regarding IllegalLocationConstraintException?

Problem scenario
You run a command like this:

aws s3api create-bucket –bucket coolnameforbucket

But you get this error:
“An error occurred (IllegalLocationConstraintException) when calling the CreateBucket operation: The unspecified location constraint is incompatible for the region specific endpoint this request was sent to.”

How do you create a bucket with the aws s3api command?

Possible Solution #1
Run a command such as this,