How Do You Install Nginx on a CentOS/RHEL/Fedora Server?

Problem scenario
You want to install Nginx on a CentOS/RHEL/Fedora Linux server.  What do you do?

Solution
1.  Create a file here: /etc/yum.repos.d/nginx.repo

2.  It should have these five non-blank lines:

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/mainline/centos/7/$basearch/
gpgcheck=0
enabled=1

3.  Run these commands:

sudo yum -y update
sudo yum -y install nginx
sudo systemctl start nginx

How Do You Comment out a Line in PHP?

Problem scenario
You want to try some .php scripts or web pages without certain lines of code.  How do you comment out an individual line?

Solution
Use this at the beginning of a line of code: //

Example:  //this text will do nothing in the .php script

To comment out multiple lines, use this at the beginning of the first line: /*
Then conclude the multi-line comment with this: 

How Do You Troubleshoot Connecting to a Postgres Database When You Get the Error “FATAL: Ident Authentication Failed”?

Problem scenario
You are trying to establish a connection with a username and password to a Postgres database using PHP.  You have a PHP file like this:  

<?php
   $host        = “host=127.0.0.1”;
   $port        = “port=5432”;
   $dbname      = “dbname=contint”;
   $credentials = “user=contint password=excellent”;

   $db = pg_connect( “$host $port $dbname $credentials”  );
   if(!$db){
      echo “Error : Unable to open database\n”;

How Do You Get the Apache Web Service to Start after a Cold Reboot?

Problem scenario
You want the Apache web service to start automatically after a Linux server is rebooted.  You want it to start automatically when you turn on a Linux server (after being off completely).  On Linux CentOS you have this entry in /etc/crontab:

@reboot            root         apachectl start

You notice that on reboots (warm or soft) it works.  But when you turn on your server after it has been off,

How Do You Get Apache Web Service to Start Automatically after a Reboot of a CentOS Linux Server?

Problem scenario  
You have to manually start Apache web server every time you do reboot the server.  You want the Apache web service to start automatically.

Solution
1.  Edit /etc/crontab.  Add the lowest line of these two (the line above is for reference):

# *  *  *  *  * user-name  command to be executed
@reboot         root       apachectl start

2.

How Do You Fix a PHP Web Page when the Page Is Completely Blank?

Problem scenario
Using a web browser you go to a PHP web page.  There are no errors, but the page is blank.  It is just all white, but you expect content to be rendered (e.g., text should be visible).  The WSOD (white screen of death) is a common problem to troubleshoot in a web browser.  What do you do to see output you want it to display?  

Solution
1.

How Do You Troubleshoot an Apache Web Service Problem when from a Web Browser You Receive the Error “The Address Is Restricted”?

Problem scenario
You are using Oracle VirtualBox on a Windows host.  You are using a Linux guest that is running Apache web server.  The Apache httpd service is running on the guest Linux server.  But when you are on the Windows host, you try to access the website, you get an error in the web browser.  This is the error you receive:

“This address is restricted
This address uses a network port which is normally used for purposes other than Web browsing.

How Do You View the Website That Your Oracle VirtualBox Guest Server Is Presenting with a Web Browser on Your Windows Host?

Problem scenario:  You have a Linux VM guest running on Oracle VirtualBox.  You installed Apache web server on this server.  How do you browse to its website from your Windows host machine?

Solution

#1  Determine the host IP address as configured for the guest.  In Oracle VirtualBox go to Devices -> Network -> Network Settings.  For Adapter1 go to “Advanced” and click the button for “Port Forwarding.” The host IP address may be 127.0.1.1.

How Do You Download a File With PowerShell When You Get the Error “Not enough space on disk”?

Problem scenario
You are using PowerShell 3.0 on Windows 7 and you try to run the PowerShell command start-bitstransfer to download a large file.  Running start-bitstransfer results in an error that says “Not Enough space on disk.” 

Solution
Verify the size of the file.  See if the destination directory/drive has sufficient space.  If this error happens despite there being ample space available in the destination drive and destination directory compared to the size of the source media, 

How Do You Redirect The Output of Lynx to a Regular File?

Problem scenario:  You are using Lynx and you want to redirect the downloaded web page to a file.  You do not want it to be sent to standard out (also referred to as printed to the screen).  What do you do?

Solution

You should use the “-dump” flag between the “lynx” utility word and the URL.  Then use the regular POSIX redirect symbol “>” at the end of the Linux command.