Author Archives: Geneva Sibanda

About Geneva Sibanda

I assist companies in the Areas of Network Infrastructure Design and Implementation: (from Windows Active Directory Security, networking, etc.).

How to Install Let’sEncrypt to work with Nginx HTTPS on Ubuntu Server

Let’s Encrypt is a free, automated, and open certificate authority (CA), run for the public’s benefit. Let’s Encrypt is a service provided by the Internet Security Research Group (ISRG).

The key principles behind Let’s Encrypt are:

◾ Free: Anyone who owns a domain name can use Let’s Encrypt to obtain a trusted certificate at zero cost.
◾ Automatic: Software running on a web server can interact with Let’s Encrypt to painlessly obtain a certificate, securely configure it for use, and automatically take care of renewal.
◾ Secure: Let’s Encrypt will serve as a platform for advancing TLS security best practices, both on the CA side and by helping site operators properly secure their servers.
◾ Transparent: All certificates issued or revoked will be publicly recorded and available for anyone to inspect.
◾ Open: The automatic issuance and renewal protocol will be published as an open standard that others can adopt.
◾ Cooperative: Much like the underlying Internet protocols themselves, Let’s Encrypt is a joint effort to benefit the community, beyond the control of any one organization.

To benefit fully from this guide I recommend that you learn by practice. Choose Your VPS Plan here at DigitalOcean, or HostGator has quality virtual private server (VPS) server packages. Sign Up for VPS HERE Now!

The New HostGator VPS Is Stronger Than Ever!

A HostGator VPS is completely customizable and can be upgraded any time as your site grows. Full root access allows you total control, as well as the ability to install advanced software and completely customize your hosting environment. It truly is dedicated functionality without the expense.

Download and install git to your system.

root@gs01:~# apt-get install git

Download, Clone and Install Let’s Encrypt

root@gs01:~#sudo git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt

Change directory

root@gs01:~# cd /opt/letsencrypt
root@gs01:/opt/letsencrypt#

Create an SSL Certificate
Let’s Encrypt automatically performs Domain Validation (DV) using a series of challenges. The Certificate Authority (CA) uses challenges to verify the authenticity of your computer’s domain. Once your server is validated, the CA will issue SSL certificates to you.

Run Let’s Encrypt with the –standalone parameter. For each additional domain name requiring a certificate, add -d example.com to the end of the command.

To obtain a cert I used the Webroot plugin to request an SSL certificate with these commands.

root@gs01:/opt/letsencrypt#./letsencrypt-auto certonly -a webroot --webroot-path=/var/www/YourFolder/public_html -d magwinya.co.za -d www.magwinya.co.za

Specify an administrative email address. This will allow you to regain control of a lost certificate and receive urgent security notices if necessary. Press TAB followed by ENTER or RETURN to save.

Agree to the Terms of Service.

IMPORTANT NOTES:
 - If you lose your account credentials, you can recover through
   e-mails sent to youremail@yourdoamin.whatever.
 - Congratulations! Your certificate and chain have been saved at
   /etc/letsencrypt/live/magwinya.co.za/fullchain.pem. Your cert will
   expire on 2016-06-18. To obtain a new version of the certificate in
   the future, simply run Let's Encrypt again.
 - Your account credentials have been saved in your Let's Encrypt
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Let's
   Encrypt so making regular backups of this folder is ideal.
 - If you like Let's Encrypt, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

Configure Your Nginx Server Block to look as follows:

root@gs01:~# cat /etc/nginx/sites-available/magwinya.co.za
# You may add here your
# server {
#       ...
# }
# statements for each of your virtual hosts to this file

##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

# Server Block Configuration for magwinya.co.za
server {
        listen 8080;
#       listen [::]:81 default_server ipv6only=on;

        root /var/www/YourFolder/public_html;
        index index.php index.html index.htm;

        location ^~ /.well-known/ {
        allow all;
        }

        ssl on;
        #listen [::]:443 ipv6only=on;
        listen 443;
        # Make site accessible from http://localhost/
        server_name magwinya.co.za www.magwinya.co.za;
        # rewrite     ^   https://my.magwinya.co.za$request_uri? permanent;

        ssl_certificate /etc/letsencrypt/live/magwinya.co.za/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/magwinya.co.za/privkey.pem;
        ssl_stapling on;
        ssl_stapling_verify on;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
        ssl_dhparam /etc/ssl/certs/dhparam.pem;
        ssl_prefer_server_ciphers on;
        ssl_session_cache shared:SSL:10m;

        # force https-redirects
        if ($scheme = http) {
        return 301 https://www.magwinya.co.za$request_uri;
        }


        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ /index.php?q=$uri&$args;
                # Uncomment to enable naxsi on this location
                # include /etc/nginx/naxsi.rules
        }

        location /doc/ {
                alias /usr/share/doc/;
                autoindex on;
                allow 127.0.0.1;
                allow ::1;
                deny all;
        }

        # Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests
        #location /RequestDenied {
        #       proxy_pass http://127.0.0.1:8080;
        #}

        error_page 404 /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
                root /usr/share/nginx/html;
        }

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php$ {
        #       fastcgi_split_path_info ^(.+\.php)(/.+)$;
        #       # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
        #
        #       # With php5-cgi alone:
        #       fastcgi_pass 127.0.0.1:9000;
        #       # With php5-fpm:
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        location ~ /\.ht/ {
                deny all;
        }
}


# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
#       listen 8000;
#       listen somename:8080;
#       server_name somename alias another.alias;
#       root html;
#       index index.html index.htm;
#
#       location / {
#               try_files $uri $uri/ =404;
#       }
#}


# HTTPS server
#
#server {
#       listen 443;
#       server_name localhost;
#
#       root html;
#       index index.html index.htm;
#
#       ssl on;
#       ssl_certificate cert.pem;
#       ssl_certificate_key cert.key;
#
#       ssl_session_timeout 5m;
#
#       ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
#       ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
#       ssl_prefer_server_ciphers on;
#
#       location / {
#               try_files $uri $uri/ =404;
#       }
#}
root@gs01:~#

Manage the Nginx Process

Now that you have your certificate up and running, we can go over some basic management commands.

To stop and then start the service again, type:

root@gs01:~# service nginx restart
root@gs01:~# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
root@gs01:~#

Now browse your site and i should be using HTTPS.

Renewing a or Multiple Certificates.

Once you have your certificate setup, you can add a simple shell cron entry to renew the certificate automatically for you:

Change Directory.

root@gs01:~# cd /usr/local/bin

Create a shell script and renew certificates

root@gs01:/usr/local/bin#vi letsencrypt-auto-renew.sh

And then copy and paste this shell script:

#!/bin/bash
#
# Created by Geneva Sibanda 
# For All His eSG NETWORKS - Ubuntu Nginx Web Hosting Servers.
# https://www.esgnet.co.za
#
###########################################
#                                         #
# Execute the Let'sEncrypt-auto renew     #
#                                         #
###########################################
##    all actions and set full path too  ##
web_service='nginx'
cd /opt/letsencrypt
./letsencrypt-auto renew
sudo git pull
# We All Have To Do Something Meaningful In Life.
echo "Reloading $web_service"
/usr/sbin/service $web_service reload
exit 0

Create a new cron job that will execute the letsencrypt-auto renew.

root@gs01:/usr/local/bin#crontab -e 

30 2 * * 1 bash /usr/local/bin/letsencrypt-auto-renew.sh

Save and exit: Now every Monday at 2:30 am, the command will run, check and update your SSL certificate.

Conclusion

That’s it! Your web server is now using a free Let’s Encrypt TLS/SSL certificate to securely serve HTTPS content.

How to Add Package on VestaCP

Previously on How to install VestaCP Nginx Only on ubuntu Server I showed you the installation part. So this article is the next guide about how to configure VestaCP for shared hosting based packages and how to add package on VestaCP server. You can get the basic information on my previous tutorial here.

Step-by-step guide on how to use and add package on VestaCP Server.

Remember the best way to learn any new technical skill, is to play around and see how things work. Get comfortable you’re few steps in right direction. Click HERE to Order Your VPS NOW! so that you can gain the practical experience needed.

Now 50% OFF! VPS hosting solutions optimized for you: Click HERE to Order NOW!

Step One: is “to login to Vesta Control Panel”: https://10.11.1.38:8083/

Then login as Admin and Your Password:

Step Two:Click on Packages and ADDING PACKAGE

Step Three: Adding Hosting Packages

 
	
Package Name
eN-200

Web Template
NGINX

Backend Template
PHP5-FPM

DNS Template
BIND9

SSH Access
nologin

Web Domains
1
  
Web Aliases (per domain)
5
  
DNS domains
1
  
DNS records (per domain)
10
  
Mail Domains
1
  
Mail Accounts (per domain)
20
  
Databases
1
  
Cron Jobs
7
  
Backups
7
Quota (in megabytes)
1000
  
Bandwidth (in megabytes)
1000
  
Name servers
gs1.esgnet.lan
gs2.esgnet.lan

ADD ONE MORE NAME SERVER 

Click Add

At the end Your Package will look as below:

That’s it. It is so easy to use VestaCP. In the next guide I will show you how to add Users and assign hosting packages.

How to Study Bachelor of Science in Computing Through UNISA

Bachelor of Science in Computing

Qualification code: 98906
NQF level: 7
Total credits: 360

I am actually studying a Bachelor of Science in Computing at UNISA (98906).

Studying with UNISA can be both challenging and rewarding. The work load is very hectic, if you are hard working, self-motivated and self discipline you are guaranteed to do exceptionally well.

UNISA encourages you to access all study guides, assignments etc via MyUnisa.

Assignment contributes handsomely towards the year mark. As such you need to take your assignments  very serious. As soon you receive or have access to your  UNISA Official Study Material,  start tackling assignments immediately.

To do exceedingly well in your module exam, you need to make sure that your assignment mark is above 95%, with that % the possibility of passing is high.

To be continued…

How to install VestaCP Nginx Only on ubuntu Server

Vesta Control Panel:

VestaCP is an Open Source web hosting control panel with premium features, secure, advanced and minimalistic design.

Vesta CP has all the features for easy and fast operation, without the need for a “manual” editing of configuration files. Right after installation the following is completely supported:

◾Apache + nginx as a webserver;
◾DNS-server;
◾Mail server, including the setting up of DKIM, spam filter and antivirus;
◾The stable version of PHP;
◾Database management system MySQL 5.5;
◾Built-in backup functions;
◾Task Scheduler (cron);
◾Monitoring server load;
◾Fast, multi-language interface

Panel installation process is very simple and can be done even by a beginner. In order to start, you need to decide with your operating system – Vesta CP successfully works on Centos, Ubuntu and Debian. For this guide I used Ubuntu Server 14.04 of the OS.

Remember the best way to learn any new technical skill, is to play around and see how things work. Get comfortable you’re few steps in right direction. Click HERE to Order Your VPS NOW! so that you can gain the practical experience needed.

Now 50% OFF! VPS hosting solutions optimized for you: Click HERE to Order NOW!

How to install

Connect to your server ssh as root via putty:

Update your Ubuntu Server

root@ns1:~# apt-get update && sudo apt-get -y upgrade && sudo apt-get -y dist-upgrade && sudo apt-get -y autoremove

Then I edited /etc/hosts. Setup it look like this:

root@ns1:~# vi /etc/hosts

Now run

root@ns1:~# echo ns1.magwinya.co.za /etc/hostname
root@ns1:~# service hostname restart

Afterwards, run

root@ns1:~# hostname
root@ns1:~# hostname -f

Both should show ns1.magwinya.co.za now.
Download the VestaCP installation script

root@ns1:~# curl -O http://vestacp.com/pub/vst-install.sh
<root@ns1:~# ls
vst-install.sh

Run it

root@ns01:~# bash vst-install.sh --nginx yes --phpfpm yes --apache no --vsftpd no --proftpd yes --exim yes --dovecot yes --spamassassin yes --clamav yes --named yes --iptables yes --fail2ban yes --mysql yes --postgresql no --remi no --quota yes

_| _| _|_|_|_| _|_|_| _|_|_|_|_| _|_|
_| _| _| _| _| _| _|
_| _| _|_|_| _|_| _| _|_|_|_|
_| _| _| _| _| _| _|
_| _|_|_|_| _|_|_| _| _| _|

Vesta Control Panel

Following software will be installed on your system:
– Nginx Web Server
– PHP-FPM Application Server
– Bind DNS Server
– Exim mail server + Antivirus Antispam
– Dovecot POP3/IMAP Server
– MySQL Database Server
– ProFTPD FTP Server
– Iptables Firewall + Fail2Ban

Would you like to continue [y/n]:y

Please enter admin email address: your@yourdomain.co.za
Please enter FQDN hostname [ns01]: ns01.magwinya.co.za

bash vst-install.sh

=======================================================

_| _| _|_|_|_| _|_|_| _|_|_|_|_| _|_|
_| _| _| _| _| _| _|
_| _| _|_|_| _|_| _| _|_|_|_|
_| _| _| _| _| _| _|
_| _|_|_|_| _|_|_| _| _| _|

——————————-
https://192.168.10.63:8083
username: admin
password: kMtXWuyZ5t
——————————-

Congratulations, you have successfully installed Vesta Control Panel and you can logon and get started using VestaCP

That is all. Next time you create a web domain from vesta it will be configured to use Nginx + PHP-fpm as a webserver instead of proxying for apache.

Good luck

Fully functional CRM & Sales System for Your Small Business.

OUR SALES & CRM is a fully functional CRM & Sales System, to help your company empower your sales department with a complete CRM & Sales solution that they can use to boost sales dramatically.

Competitive Advantage:

OUR SALES & CRM helps you record leads, opportunities, add new customers, add main contacts, register sales orders, create quotations and create invoices.

The whole sales process simplified in a simple modern light-weight system that will change how you do business. Most if not all systems out there are using the SAAS model or were built using a complicated business processes that will take you a while to understand, we built OUR SALES & CRM using simple modern practical business approaches.

This means that customizing the software to your needs will be easier than any other system out there. We also implemented the pricelist system so you can add discounts for certain customers within a certain period of time. OUR SALES & CRM also contains a simple email application to receive and send emails from within this software. We aim to make your whole sales process easier and smoother.

Core Features:

Leads Management
Opportunities
Customer & Contacts Management
Calls Logs
Meetings Schedule
Products Categories
Sales Reps – Assign to Customers
Quotations
Sales Orders
Invoicing & Payments
Pricelists
Contracts
Calendar

Application Security Access Control:

Super User
Base User
Customer

I’m happy to arrange a pilot project so that you can see how the solution fits within your organisational operations. Please note that the entire solution is on a SAAS business model, meaning that the service is fully hosted on my cloud servers.

Price Est: R165p/m Exl VAT.

cakePHP 3 Installation Step by Step

CakePHP is a powerful and robust PHP framework built around the Model-View-Controller (MVC) programming paradigm. In addition to the flexible way you can use it to build your application, it provides a basic structure for organizing files, classes and database table names – keeping everything consistent and logical.

Installing CakePHP 3 on Ubuntu 16.04.

CakePHP is simple and easy to install. The minimum requirements are a web server and a copy of CakePHP, that’s it! While this guide focuses primarily on setting up on Nginx (because it’s simple to install and setup), CakePHP will run on a variety of web servers such as Apache2, LightHTTPD, or Microsoft IIS.

Additionally, since databases are part of most web applications, CakePHP supports a number of drivers such as MySQL, PostgreSQL, Microsoft SQL Server or SQLite (all with their respective PDO extensions installed).

Remember the best way to learn any technical skill, is to play around and see how things work. Get comfortable you’re few steps in right direction. Click HERE to Order Your VPS NOW! so that you can gain the practical experience.

Now 50% OFF! VPS hosting solutions optimized for you: Click HERE to Sign UP NOW!

Requirements.

  • HTTP Server. For example: Nginx. Having mod_rewrite is preferred, but
    by no means required.
  • PHP 5.4.16 or greater.
  • mbstring extension
  • intl extension

CakePHP uses Composer, a dependency management tool for PHP 5.3+, as the officially supported method for installation.

First, you’ll need to download and install Composer if you haven’t done so already. If you have cURL installed, it’s as easy as running the following:

Run these commands to globally install composer on your ubuntu server system:

sibanda@gs2:~#curl -s https://getcomposer.org/installer | php

sibanda@gs2:~#ls

sibanda@gs2:~#sudo mv composer.phar /usr/local/bin/composer

You should execute the command mkdir -p which will create the directory in your server to place cakePHP.

sibanda@gs2:~#mkdir -p /var/www/cakephp/public_html

Now you need to grant www-data access to files with 750 permissions

sibanda@gs2:~#sudo chown -R www-data:www-data /var/www/cakephp/public_html

Set Up Nginx Server Blocks (Virtual Hosts).

sibanda@gs2:~#cp -f /etc/nginx/sites-available/default /etc/nginx/sites-available/cake.mwired.lan

Nginx Serverblock configuration should look something like this:

sibanda@gs2:~#vi /etc/nginx/sites-available/cake.mwired.lan

# You may add here your
# server {
#       ...
# }
# statements for each of your virtual hosts to this file

##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

# Server Block Configuration for cake.mwired.lan
server {
        listen 80;
#       listen [::]:80 default_server ipv6only=on;

        root /var/www/cakephp/public_html/app/webroot;
        index index.php index.html index.htm;

        # Make site accessible from http://localhost/
        server_name cake.mwired.lan;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ /index.php?q=$uri&$args;
                # Uncomment to enable naxsi on this location
                # include /etc/nginx/naxsi.rules
        }

        location /doc/ {
                alias /usr/share/doc/;
                autoindex on;
                allow 127.0.0.1;
                allow ::1;
                deny all;
        }

        # Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests
        #location /RequestDenied {
        #       proxy_pass http://127.0.0.1:8080;
        #}

        error_page 404 /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
                root /usr/share/nginx/html;
        }

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php$ {
        #       fastcgi_split_path_info ^(.+\.php)(/.+)$;
        #       # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
        #
        #       # With php5-cgi alone:
        #       fastcgi_pass 127.0.0.1:9000;
        #       # With php5-fpm:
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        location ~ /\.ht/ {
                deny all;
        }
}


# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
#       listen 8000;
#       listen somename:8080;
#       server_name somename alias another.alias;
#       root html;
#       index index.html index.htm;
#
#       location / {
#               try_files $uri $uri/ =404;
#       }
#}


# HTTPS server
#
#server {
#       listen 443;
#       server_name localhost;
#
#       root html;
#       index index.html index.htm;
#
#       ssl on;
#       ssl_certificate cert.pem;
#       ssl_certificate_key cert.key;
#
#       ssl_session_timeout 5m;
#
#       ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
#       ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
#       ssl_prefer_server_ciphers on;
#
#       location / {
#               try_files $uri $uri/ =404;
#       }
#}

Copy your Nginx Server Blocks (Virtual Hosts) as follows:

sibanda@gs2:~#cp -f /etc/nginx/sites-available/cake.mwired.lan /etc/nginx/sites-enabled/cake.mwired.lan

The nginx package comes with scripts that provides the usual start|stop|restart|reload … functionality.

sibanda@gs2:~#service nginx restart

Change the folder to where you will have CakePHP application files.

sibanda@gs2:~#cd /var/www/cakephp/public_html/

Now that you’ve prepared the environment and installed Composer globally, Composer will start downloading the application skeleton and the core CakePHP library, you will have a functioning CakePHP application installed via Composer, you can get a new CakePHP application by running:

sibanda@gs2:/var/www/cakephp/public_html#composer create-project --prefer-dist cakephp/app

Installing cakephp/app (3.1.2)
  - Installing cakephp/app (3.1.2)
    Loading from cache

Created project in /var/www/cakephp/public_html/app
Loading composer repositories with package information
Installing dependencies (including require-dev)
- Installing aura/installer-default (1.0.0)
    Loading from cache

  - Installing cakephp/plugin-installer (0.0.12)
    Loading from cache

  - Installing psr/log (1.0.0)
    Loading from cache

  - Installing nesbot/carbon (1.13.0)
    Loading from cache

  - Installing mobiledetect/mobiledetectlib (2.8.17)
    Loading from cache

  - Installing aura/intl (1.1.1)
    Loading from cache

  - Installing ircmaxell/password-compat (v1.0.4)
    Loading from cache

  - Installing cakephp/cakephp (3.1.5)
    Loading from cache

  - Installing symfony/yaml (v2.8.0)
    Loading from cache

  - Installing symfony/filesystem (v3.0.0)
    Loading from cache

  - Installing symfony/config (v2.8.0)
    Loading from cache

  - Installing symfony/polyfill-mbstring (v1.0.0)
    Loading from cache

  - Installing symfony/console (v2.8.0)
    Loading from cache

  - Installing robmorgan/phinx (v0.5.0)
    Loading from cache

  - Installing cakephp/migrations (1.5.1)
    Loading from cache

  - Installing jakub-onderka/php-console-color (0.1)
    Loading from cache

  - Installing jakub-onderka/php-console-highlighter (v0.3.2)
    Loading from cache

  - Installing dnoegel/php-xdg-base-dir (0.1)
    Loading from cache

  - Installing nikic/php-parser (v2.0.0)
    Loading from cache

  - Installing symfony/var-dumper (v3.0.0)
    Loading from cache

  - Installing psy/psysh (v0.6.1)
    Loading from cache

  - Installing jdorn/sql-formatter (v1.2.17)
    Loading from cache

  - Installing cakephp/debug_kit (3.2.2)
    Loading from cache

  - Installing cakephp/bake (1.1.2)
    Loading from cache

symfony/console suggests installing symfony/event-dispatcher ()
symfony/console suggests installing symfony/process ()
symfony/var-dumper suggests installing ext-symfony_debug ()
psy/psysh suggests installing ext-pdo-sqlite (The doc command requires SQLite to work.)
cakephp/debug_kit suggests installing ext-sqlite (DebugKit needs to store panel data in a database. SQLite is simple and easy to use.)
Writing lock file
Generating autoload files
> Cake\Composer\Installer\PluginInstaller::postAutoloadDump
> App\Console\Installer::postInstall
Created `config/app.php` file
Set Folder Permissions ? (Default to Y) [Y,n]? y
Permissions set on /var/www/cakephp/public_html/app/tmp/cache
Permissions set on /var/www/cakephp/public_html/app/tmp/cache/models
Permissions set on /var/www/cakephp/public_html/app/tmp/cache/persistent
Permissions set on /var/www/cakephp/public_html/app/tmp/cache/views
Permissions set on /var/www/cakephp/public_html/app/tmp/sessions
Permissions set on /var/www/cakephp/public_html/app/tmp/tests
Permissions set on /var/www/cakephp/public_html/app/tmp
Permissions set on /var/www/cakephp/public_html/app/logs
Updated Security.salt value in config/app.php

Once Composer finishes downloading be sure to keep the composer.json and composer.lock files with the rest of your source code.

Create MySQL Database

You would need special privileges to create or to delete a MySQL database. So assuming you have access to root user, you can create any database using “mysql -u root -p” command line.

Here is a simple example to create database called cake3

From the console you can create the database:

root@gs2:/var/www/app/public_html# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.6.27-2 (Ubuntu)

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database cake3;
Query OK, 1 row affected (0.27 sec)

mysql> GRANT ALL PRIVILEGES ON cake3.* TO gs2star@localhost IDENTIFIED BY 'typeyourpasswordhere';
Query OK, 0 rows affected (0.55 sec)

mysql> flush privileges;

Now visit the path to where you installed your CakePHP application and Setup the values of ‘cake3 database’ in app/config/app.php

root@gs2:/var/www/app/public_html# vi app/config/app.php


'Datasources' => [
        'default' => [
            'className' => 'Cake\Database\Connection',
            'driver' => 'Cake\Database\Driver\Mysql',
            'persistent' => false,
            'host' => 'localhost',
            /**
             * CakePHP will use the default DB port based on the driver selected
             * MySQL on MAMP uses port 8889, MAMP users will want to uncomment
             * the following line and set the port accordingly
             */
            //'port' => 'nonstandard_port_number',
            'username' => 'gs2star',
            'password' => 'typeyourpasswordhere',
            'database' => 'cake3',
            'encoding' => 'utf8',
            'timezone' => 'UTC',
            'cacheMetadata' => true,
            'log' => false,

You can now visit your URL and Get the Ovens Ready.

More about Cake

CakePHP is a rapid development framework for PHP which uses commonly known design patterns like Front Controller and MVC.

That’s it for now! If you have any questions or need assistance, please don’t hesitate to contact me.

In the next article we will play a bit with CakePHP to create a simple Invoicing, Accounting & CRM, Billing and Business Management app that will be used by Small Businesses in South Africa and the world.

Easily deploy an SSD cloud server

Easily deploy an SSD cloud server on @esgnet in 55 seconds. Sign up using my link and receive $10 in credit: https://www.digitalocean.com/?refcode=2d36b262058d

Just a quick friendly reminder to let you know that we’re open for business, standing ready to WOW you! Promote your business on online now.

How To Install (LEMP), Linux, nginx, MySQL, PHP stack on Ubuntu 15.10

LEMP stacks are an open source platform for web applications consisting of Linux, Nginx, MySQL or MariaDB, and PHP or another language such as Python.

L – Linux
E – Nginx (Pronounced Engine-X)
M – MySQL
P – PHP

Remember the best way to learn any new technical skill, is to play around and see how things work. Get comfortable you’re few steps in right direction. Click HERE to Order Your VPS NOW! so that you can gain the practical experience needed.

Now 50% OFF! VPS hosting solutions optimized for you: Click HERE to Order NOW!

Step 1 Log in to your Linux server with the root user. This has taken care of the ‘L’ of LEMP.

Step 2 Next we will update all the softwares to the latest versions

sibanda@gs2:~# sudo apt-get update

Step 3 Install MySQL on the server with the following command :

sibanda@gs2:~# sudo apt-get install mysql-server php5-mysql

You would be prompted to enter a password for your MySQL.

Once the installation is complete activate it using the following command :

sibanda@gs2:~# sudo mysql_install_db

Next run the MySQL set up script :

sibanda@gs2:~# sudo /usr/bin/mysql_secure_installation

You will be prompted to enter your password. Then you will be asked to change the root password, type N and move on. For the rest of the options chose ‘Y’.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.


Remove anonymous users? [Y/n] y

 ... Success!



Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.



Disallow root login remotely? [Y/n] y
... Success!



By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.



Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!



Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.



Reload privilege tables now? [Y/n] y
 ... Success!



Cleaning up...

Step 4 Install PHP

sibanda@gs2:~# sudo apt-get install php5-fpm

Open www.conf file

sibanda@gs2:~# sudo vi /etc/php5/fpm/pool.d/www.conf

Find the line

;listen = /var/run/php5-fpm.sock
; listen = 127.0.0.1:9000

and change it to

listen = /var/run/php5-fpm.sock
Save the file and exit and restart php-fpm :

sibanda@gs2:~# sudo service php5-fpm restart

Step 5 Install nginx

sibanda@gs2:~# echo "deb http://ppa.launchpad.net/nginx/stable/ubuntu $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/nginx-stable.list
sibanda@gs2:~# sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C300EE8C
sibanda@gs2:~# sudo apt-get update && sudo apt-get install nginx

You need to start nginx by typing :

sibanda@gs2:~# sudo service nginx start

Step 6 Copy the default config file for Nginx

sibanda@gs2:~# sudo cp -rf /etc/nginx/sites-available/default /etc/nginx/sites-available/magwinya.co.za

I normally delete the default nginx server block to avoid “conflicting server name” error.

sibanda@gs2:~# sudo rm -rf /etc/nginx/sites-available/default

Step 7 Open the copied config file for Nginx

sibanda@gs2:~# sudo vi /etc/nginx/sites-available/magwinya.co.za

The Server block for the config file should have the following settings

# You may add here your
# server {
#       ...
# }
# statements for each of your virtual hosts to this file

##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

# Server Block Configuration for www.magwinya.co.za
server {
        listen 80;
#       listen [::]:80 default_server ipv6only=on;

        root /home/mwired/public_html;
        index index.php index.html index.htm;

        # Make site accessible from http://localhost/
        server_name magwinya.co.za www.magwinya.co.za;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ /index.php?q=$uri&$args;
                # Uncomment to enable naxsi on this location
                # include /etc/nginx/naxsi.rules
        }

        location /doc/ {
                alias /usr/share/doc/;
                autoindex on;
                allow 127.0.0.1;
                allow ::1;
                deny all;
        }

        # Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests
        #location /RequestDenied {
        #       proxy_pass http://127.0.0.1:8080;
        #}

        error_page 404 /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
                root /usr/share/nginx/html;
        }

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php$ {
        #       fastcgi_split_path_info ^(.+\.php)(/.+)$;
        #       # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
        #
        #       # With php5-cgi alone:
        #       fastcgi_pass 127.0.0.1:9000;
        #       # With php5-fpm:
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        location ~ /\.ht/ {
                deny all;
        }
}


# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
#       listen 8000;
#       listen somename:8080;
#       server_name somename alias another.alias;
#       root html;
#       index index.html index.htm;
#
#       location / {
#               try_files $uri $uri/ =404;
#       }
#}


# HTTPS server
#
#server {
#       listen 443;
#       server_name localhost;
#
#       root html;
#       index index.html index.htm;
#
#       ssl on;
#       ssl_certificate cert.pem;
#       ssl_certificate_key cert.key;
#
#       ssl_session_timeout 5m;
#
#       ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
#       ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
#       ssl_prefer_server_ciphers on;
#
#       location / {
#               try_files $uri $uri/ =404;
#       }
#}

Step 8

sibanda@gs2:~# sudo cp /etc/nginx/sites-available/magwinya.co.za /etc/nginx/sites-enabled/

Alternatively, you can activate the host by creating a symbolic link between the sites-available directory and the sites-enabled directory.

sibanda@gs2:~# sudo ln -s /etc/nginx/sites-available/magwinya.co.za /etc/nginx/sites-enabled/magwinya.co.za

Important: Restart php-fpm and nginx so that changes can take effect.

sudo service php5-fpm restart && service nginx restart

How to upgrade to Ubuntu 14.04 Server

Before upgrading it is always recommended that you create a backup first.

Step 1 : Check the current version of Ubuntu

Remember the best way to learn any new technical skill, is to play around and see how things work. Get comfortable you’re few steps in right direction. Click HERE to Order Your VPS NOW! so that you can gain the practical experience needed.

Now 50% OFF! VPS hosting solutions optimized for you: Click HERE to Order NOW!

sibanda@gs2:~# lsb_release -a

This should return an output in the following format :

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.3 LTS
Release:        14.04
Codename:       trusty

Step 2 : Now we need to update the package list and install the update-manager-core package if it is not already installed:

sibanda@gs2:~# apt-get update && apt-get install update-manager-core

Step 3 : Upgrade to the latest LTS release of Ubuntu, using the below mentioned command. This command will open up a upgrade tool. Just follow the on screen instructions to complete :

sibanda@gs2:~# do-release-upgrade

In case you get the following message from this command, it means taht there is no newer LTS version available :

Checking for a new Ubuntu release No new release found But if you still want to upgrade to the latest version of Ubuntu, regardless of it have LTS (Long term support), you can use the same command but with a ‘-d’ option :

sibanda@gs2:~# do-release-upgrade -d

Step 4 : After the installation is completed, it is recommended that you reboot the server and check the new settings :

sibanda@gs2:~# reboot
sibanda@gs2:~# lsb_release -a

How to install ClamAV on Ubuntu Server

What is ClamAV®?

ClamAV® is an open source antivirus engine for detecting trojans, viruses, malware & other malicious threats.

ClamAV® can be easily installed via Terminal on your ubuntu Server.

root@gs2:~# apt-get install clamav

Once ClamAV® is installed, the first thing you have do is to update the virus definitions with:

root@gs2:~# freshclam
ClamAV update process started at Fri Oct  3 23:42:51 2015
main.cvd is up to date (version: 55, sigs: 2424225, f-level: 60, builder: neo)
daily.cld is up to date (version: 20952, sigs: 1589971, f-level: 63, builder: jesler)
bytecode.cld is up to date (version: 268, sigs: 47, f-level: 63, builder: anvilleg)
root@gs2:~#

Then you can scan for viruses.

For Example:

•To check all files on the computer, displaying the name of each file:

root@gs2:~# clamscan -r /


----------- SCAN SUMMARY -----------
Known viruses: 4008679
Engine version: 0.98.7
Scanned directories: 23613
Scanned files: 92730
Infected files: 0
Total errors: 11692
Data scanned: 2375.55 MB
Data read: 2647.36 MB (ratio 0.90:1)
Time: 2464.365 sec (41 m 4 s)
root@gs2:~#

•To check all files on the computer, but only display infected files and ring a bell when found:

root@gs2:~# clamscan -r --bell -i /

----------- SCAN SUMMARY -----------
Known viruses: 4008679
Engine version: 0.98.7
Scanned directories: 23613
Scanned files: 92730
Infected files: 0
Total errors: 11692
Data scanned: 2375.55 MB
Data read: 2647.36 MB (ratio 0.90:1)
Time: 2360.552 sec (39 m 20 s)
root@gs2:~#

•To check files in the all users home directories:

root@gs2:~# clamscan -r /home

----------- SCAN SUMMARY -----------
Known viruses: 4008676
Engine version: 0.98.7
Scanned directories: 9
Scanned files: 26
Infected files: 0
Data scanned: 36.14 MB
Data read: 499.79 MB (ratio 0.07:1)
Time: 15.731 sec (0 m 15 s)
root@gs2:/home/sibgen#

•To check files in the USER home directory and move infected files to another folder:

root@gs2:~# clamscan -r --move=/tmp/home/sibgen/virus /home/sibgen

----------- SCAN SUMMARY -----------
Known viruses: 4008676
Engine version: 0.98.7
Scanned directories: 8
Scanned files: 26
Infected files: 0
Data scanned: 36.14 MB
Data read: 499.79 MB (ratio 0.07:1)
Time: 15.050 sec (0 m 15 s)
root@gs2:/home/sibgen#

•To check files in the USER home directory and remove infected files (WARNING: Files are gone.):

root@gs2:~# clamscan -r --remove /home/sibgen

----------- SCAN SUMMARY -----------
Known viruses: 4008676
Engine version: 0.98.7
Scanned directories: 8
Scanned files: 26
Infected files: 0
Data scanned: 36.14 MB
Data read: 499.79 MB (ratio 0.07:1)
Time: 15.050 sec (0 m 15 s)
root@gs2:/home/sibgen#

•To see more options:

root@gs2:~# clamscan --help


                       Clam AntiVirus Scanner 0.98.7
           By The ClamAV Team: http://www.clamav.net/about.html#credits
           (C) 2007-2009 Sourcefire, Inc.

    --help                -h             Print this help screen
    --version             -V             Print version number
    --verbose             -v             Be verbose
    --archive-verbose     -a             Show filenames inside scanned archives
    --debug                              Enable libclamav's debug messages
    --quiet                              Only output error messages
    --stdout                             Write to stdout instead of stderr
    --no-summary                         Disable summary at end of scanning
    --infected            -i             Only print infected files
    --suppress-ok-results -o             Skip printing OK files
    --bell                               Sound bell on virus detection

    --tempdir=DIRECTORY                  Create temporary files in DIRECTORY
    --leave-temps[=yes/no(*)]            Do not remove temporary files
    --database=FILE/DIR   -d FILE/DIR    Load virus database from FILE or load
                                         all supported db files from DIR
    --official-db-only[=yes/no(*)]       Only load official signatures
    --log=FILE            -l FILE        Save scan report to FILE
    --recursive[=yes/no(*)]  -r          Scan subdirectories recursively
    --allmatch[=yes/no(*)]   -z          Continue scanning within file after finding a match
    --cross-fs[=yes(*)/no]               Scan files and directories on other filesystems
    --follow-dir-symlinks[=0/1(*)/2]     Follow directory symlinks (0 = never, 1 = direct, 2 = always)
    --follow-file-symlinks[=0/1(*)/2]    Follow file symlinks (0 = never, 1 = direct, 2 = always)
    --file-list=FILE      -f FILE        Scan files from FILE
    --remove[=yes/no(*)]                 Remove infected files. Be careful!
    --move=DIRECTORY                     Move infected files into DIRECTORY
    --copy=DIRECTORY                     Copy infected files into DIRECTORY
    --exclude=REGEX                      Don't scan file names matching REGEX
    --exclude-dir=REGEX                  Don't scan directories matching REGEX
    --include=REGEX                      Only scan file names matching REGEX
    --include-dir=REGEX                  Only scan directories matching REGEX

    --bytecode[=yes(*)/no]               Load bytecode from the database
    --bytecode-unsigned[=yes/no(*)]      Load unsigned bytecode
    --bytecode-timeout=N                 Set bytecode timeout (in milliseconds)
    --bytecode-statistics[=yes/no(*)]    Collect and print bytecode statistics
    --detect-pua[=yes/no(*)]             Detect Possibly Unwanted Applications
    --exclude-pua=CAT                    Skip PUA sigs of category CAT
    --include-pua=CAT                    Load PUA sigs of category CAT
    --detect-structured[=yes/no(*)]      Detect structured data (SSN, Credit Card)
    --structured-ssn-format=X            SSN format (0=normal,1=stripped,2=both)
    --structured-ssn-count=N             Min SSN count to generate a detect
    --structured-cc-count=N              Min CC count to generate a detect
    --scan-mail[=yes(*)/no]              Scan mail files
    --phishing-sigs[=yes(*)/no]          Signature-based phishing detection
    --phishing-scan-urls[=yes(*)/no]     URL-based phishing detection
    --heuristic-scan-precedence[=yes/no(*)] Stop scanning as soon as a heuristic match is found
    --phishing-ssl[=yes/no(*)]           Always block SSL mismatches in URLs (phishing module)
    --phishing-cloak[=yes/no(*)]         Always block cloaked URLs (phishing module)
    --partition-intersection[=yes/no(*)] Detect partition intersections in raw disk images using heuristics.
    --algorithmic-detection[=yes(*)/no]  Algorithmic detection
    --scan-pe[=yes(*)/no]                Scan PE files
    --scan-elf[=yes(*)/no]               Scan ELF files
    --scan-ole2[=yes(*)/no]              Scan OLE2 containers
    --scan-pdf[=yes(*)/no]               Scan PDF files
    --scan-swf[=yes(*)/no]               Scan SWF files
    --scan-html[=yes(*)/no]              Scan HTML files
    --scan-archive[=yes(*)/no]           Scan archive files (supported by libclamav)
    --detect-broken[=yes/no(*)]          Try to detect broken executable files
    --block-encrypted[=yes/no(*)]        Block encrypted archives
    --nocerts                            Disable authenticode certificate chain verification in PE files
    --dumpcerts                          Dump authenticode certificate chain in PE files

    --max-filesize=#n                    Files larger than this will be skipped and assumed clean
    --max-scansize=#n                    The maximum amount of data to scan for each container file (**)
    --max-files=#n                       The maximum number of files to scan for each container file (**)
    --max-recursion=#n                   Maximum archive recursion level for container file (**)
    --max-dir-recursion=#n               Maximum directory recursion level
    --max-embeddedpe=#n                  Maximum size file to check for embedded PE
    --max-htmlnormalize=#n               Maximum size of HTML file to normalize
    --max-htmlnotags=#n                  Maximum size of normalized HTML file to scan
    --max-scriptnormalize=#n             Maximum size of script file to normalize
    --max-ziptypercg=#n                  Maximum size zip to type reanalyze
    --max-partitions=#n                  Maximum number of partitions in disk image to be scanned
    --max-iconspe=#n                     Maximum number of icons in PE file to be scanned
    --enable-stats                       Enable statistical reporting of malware
    --disable-pe-stats                   Disable submission of individual PE sections in stats submissions
    --stats-timeout=#n                   Number of seconds to wait for waiting a response back from the stats server
    --stats-host-id=UUID                 Set the Host ID used when submitting statistical info.

(*) Default scan settings
(**) Certain files (e.g. documents, archives, etc.) may in turn contain other
   files inside. The above options ensure safe processing of this kind of data.
root@gs2:~#

ClamAV® Virus definitions update automatically every 2 hours by default, as such it is recommended to running the updated version virus definitions in order to keep your Server secure at all times. To automate this task using freshclam you need to create a shell script called freshclam.sh:

root@gs2:/usr/local/bin# vi freshclam.sh

Press i to insert text, and the "Copy and Paste" this text into your freshclam.sh shell script.

#!/bin/sh
# Automate : ClamAV® Virus definitions update
# Author : Geneva Sibanda under GPL v.2.x+
# ------------------------------------------
/usr/bin/freshclam --quiet
exit 0

To save and exit from vi, press [Esc] key on your keyboard and type : (colon) and type wq!.

Then set up a cronjob to update the virus definitions to every 3 hours by calling freshclam script created above.

0 0-23/3 * * * * * * bash /usr/local/bin/freshclam.sh

Till next time. Take Your Server Security very seriously.

NB: Remember that it is your responsibility to keep your server secure and you can install firewall. A firewall can help you block incoming and outgoing ports as well as block brute force login attempts.