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

Standard

Step 1: Install the Nginx Web Server

$ sudo apt-get update

$sudo apt-get install nginx

Enable UFW (Ubuntu Firewall)

$ sudo ufw enable

$ sudo ufw status

$ sudo ufw allow ‘Nginx HTTP’

Step 2: Install MySQL

$ sudo apt-get install mysql-server

Step 3: Install PHP 5.6

Use the following set of command to add PPA for PHP 5.6 in your Ubuntu system and install PHP 5.6.

$ sudo apt-get install python-software-properties
$ sudo add-apt-repository ppa:ondrej/php
$ sudo apt-get update
$ sudo apt-get install -y php5.6

Check Installed PHP Version:

$ php -v 

PHP 5.6.29-1+deb.sury.org~xenial+1 (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

You can install php5.6 modules too for example

sudo apt-get install php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-xml

Step 4: Install PHP5.6-FPM

To install PHP-FPM, open terminal and type in these commands. We will configure the details of nginx and php details in the next step:

$ sudo apt-get install php5.6-fpm

We need to make another small change in the php5-fpm configuration.Open up http://www.conf:

 sudo nano /etc/php/5.6/fpm/pool.d/www.conf

Find the line, listen = 127.0.0.1:9000, and change the 127.0.0.1:9000 to /run/php/php5.6-fpm.sock
.

listen = /run/php/php5.6-fpm.sock

Save and Exit.

Restart php-fpm:

/etc/init.d/php5.6-fpm restart

Step 5: Configure Nginx to Use the PHP Processor

sudo nano /etc/nginx/conf.d/default.conf

Currently, with the comments removed, the Nginx default server block file looks like this:

/etc/nginx/conf.d/default.conf
server {
    listen 80 default_server;
    listen [::]:80 default_server;

    root /var/www/html;
    index index.php index.html index.htm index.nginx-debian.html;

    server_name _;

    location / {
        try_files $uri $uri/ =404;
    }
    location ~ \.php$ {
           try_files $uri =404;
           fastcgi_pass unix:/run/php/php5.6-fpm.sock;
           fastcgi_index index.php;
           fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
           include fastcgi_params;
                
     }
}
Advertisements

Difference between SOAP and REST ??

Standard

Web services that are used to communicate in-between applications that are being developed in many programming-languages and running on different platforms. Like a Java application running on linux platform can communicate with a PHP application running on windows platform. There are two types of web services, SOAP and REST. Let us discuss some main differences between them.

SOAP vs REST – Difference between SOAP and REST Web Services

S.No SOAP REST
1. SOAP stands for Simple Object Access Protocol. REST stands for Representational State Transfer.
2. SOAP is a protocol. It defines some standards that should be followed strictly. REST is an architectural style. It doesn’t define so many standards like SOAP.
3. SOAP is highly secure as it defines its own security. REST inherits security measures from the underlying transport.
4. SOAP message request is processed slower as compared to REST. REST message request is processed faster as compared to SOAP.
5. SOAP supports only XML data format. REST supports data formats like plain text, XML, HTML, JSON, etc.
6. SOAP is not very easy to implement so it is preferred less. REST is easier to implement so it is preferred more.
7. SOAP requires more bandwidth and resources. REST requires less bandwidth and resources.
8. In java SOAP web services are implemented using JAX-WS API. In java RESTful web services are implemented using JAX-RS API.
9. It does not use web caching mechanism. It uses web caching mechanism.
10. SOAP is commonly used in payment gateways, financial and telecommunication services. REST is commonly used in social media, web chat and mobile services.

 

SOAP or REST?

If the security is a major concern and the resources are not limited then we should use SOAP web services. Like if we are creating a web service for banking related work then we should go with SOAP as here high security is needed.

On the other hand if security is not a major concern and we have limited resources. Or we want to create an API that will be easily used by other developers publicly then we should go with REST web services.

soap-vs-rest

source: https://codingsec.net/2016/06/difference-soap-rest/

How I can fix “AppStream cache update completed, but some metadata was ignored due to errors.”

Standard

I executed apt update as root, but I received this error message: AppStream cache update completed, but some metadata was ignored due to errors.

 

Answer:

The bug has been fixed in appstream package version 0.10.1, but the version that gets installed in Ubuntu 16.04 is 0.9.4 by default. Ubuntu 16.10 automatically receives the update as it’s provided in its standard repositories.

The updated package version with the bugfix for Ubuntu 16.04 however is only provided through the xenial-backports repository, which has a lower priority than the others. This means it won’t upgrade to this version unless you manually specify it.

To enable the xenial-backports repository in first place, follow How do I enable the “backports” repository? (but only enable the repository, you don’t need to modify the repo priority).

After that, upgrade to the version from xenial-backports by typing:

sudo apt install appstream/xenial-backports

Now your appstream package should be upgraded to version 0.10.1.

$ appstreamcli --version
AppStream CLI tool version: 0.10.1

Now force refreshing the cache data, you should no longer see any warning:

$ sudo appstreamcli refresh --force
AppStream cache update completed successfully.

Source link: http://askubuntu.com/questions/854168/how-i-can-fix-appstream-cache-update-completed-but-some-metadata-was-ignored-d

SAAS, PAAS and IAAS : Three ways to Cloud Computing

Standard

There typically three ways to cloud computing. People often hear about these three (PAAS, SAAS, IAAS) terms in cloud computing. Lets discuss about these three terms here. Lets know what they are, what are their pros and cons.

Firstly, abbreviations

  1. SAAS : Software as-a service
  2. PAAS : Platform as-a service
  3. IAAS : Infrastructure as-a service

IaaS vs. PaaS vs. SaaS

Continue reading

Differences Between jQuery .bind() vs .live() vs .delegate() vs .on()

Standard

Key points (tl;dr):

  • Using the .bind() method is very costly as it attaches the same event handler to every item matched in your selector.
  • You should stop using the .live() method as it is deprecated and has a lot of problems with it.
  • The .delegate() method gives a lot of “bang for your buck” when dealing with performance and reacting to dynamically added elements.
  • That the new .on() method is mostly syntax sugar that can mimic .bind(),.live(), or .delegate() depending on how you call it.
  • The new direction is to use the new .on method. Get familiar with the syntax and start using it on all your jQuery 1.7+ projects.

Continue reading