In the Context of Nginx, What Is the Difference between the default.conf and nginx.conf Files?

Question
In the Context of Nginx, What Is the Difference between the default.conf and nginx.conf Files?

Answer
For general Nginx purposes, the nginx.conf file specifies the location of the Nginx logs and the names of the log files themselves.  

For general Nginx purposes, the default.conf handles many more configuration items than nginx.conf.   The default.conf file will allow you to configure a non-standard port (other than port 80) and specifies if Nginx will act as a load balancer or a web server. 

How Do You Troubleshoot the Shell/Bash Script Error “syntax error near unexpected token”?

Problem scenario
You are trying to run a bash/shell script but you get an error message that is difficult to troubleshoot.  It looks something like this:

myscript.sh: line 4: syntax error near unexpected token `curl’
myscript.sh: line 4: `curl ‘http://10.10.0.1’ ‘

You thoroughly analyzed the line of the script that is called out in the error.  What is the root cause?

Solution
Did you define a function in the script? 

How Do You Return Basic Messages from a SQL Query to a PHP Web Page When Using LAPP?

Problem scenario
You have deployed the LAPP stack. You want a basic and meaningful message to be presented to a user of the web application after a SQL command has been run.  Currently a user can click on buttons to run SQL commands behind the scenes.  Messages that are returned to the user may be meaningless like “Resource id #4” or “Resource id #5.”  You want to augment the functionality so at least a rudimentary message (with some meaning) is returned to the user. 

How Do You Deal with An “hwloc library not found” Error?

Problem scenario
You are trying to install Snort on Ubuntu.  You have installed hwloc (because you know the command hwloc-info works).  But when you try to run a configure script (e.g., configure_cmake.sh), you get this error:

“– Could NOT find PkgConfig (missing:  PKG_CONFIG_EXECUTABLE)
CMake Error at cmake/FindHWLOC.cmake:6 (message):

        ERROR! hwloc library not found.

        Get it from https://www.open-mpi.org/projects/hwloc/

Call Stack (most recent call first):
 

How Do You Deploy LAMP with Ubuntu Linux?

Problem scenario
You want to deploy the LAMP stack on a Debian/Ubuntu distribution of Linux. You want to install and the four core technologies that compose the LAMP stack (Linux, Apache web server, MariaDB/MySQL, and PHP).   How do you do this?

Solution #1 (with MySQL)
To install the OS, Ubuntu Linux, see this link. To install MySQL run these commands:

sudo apt-get -y update
sudo apt-get -y install php apache2 mysql-server

# Provide a password for the mysql root user when prompted. …

How Do You Tell if There is a Firewall on Linux?

Problem scenario
You want to see if there is an operating system, software or host-based firewall on your Linux machine.  What do you do?

Solution
Run the following six commands for clues:

sudo ps -ef | grep firewalld
sudo systemctl status firewalld
sudo ps -ef | grep ufw
sudo ufw status
sudo iptables -L #*
sudo nmap -P0 127.0.0.1

If you are running the server in a public cloud,

How Do You Use ECR in AWS?

Problem scenario
You have heard about Amazon Elastic Container Registry.  You want to configure a Docker registry using an AWS PaaS offering.  How do you use ECR?

Solution
1.  Log into the AWS web console.
2.  Go here: https://console.aws.amazon.com/ecs/home#/repositories
3.  Click “Get started” if you have never created a repository before.  If you have created a repository, skip to the next step.
4. 

How Do You Prevent a Process from Ending Due to a User Logging Off?

Problem scenario
You want a process to keep running on a Linux server.  But when the user who starts it logs off, the process ends.  How do you allow the user to log off but obviate the logging off from terminating (through signaling termination) of that process you want to remain running?

Solution
Have the user use the nohup command to execute the important process.