Friday, December 11, 2015

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

Introduction

The LEMP software stack is a group of software that can be used to serve dynamic web pages and web applications. This is an acronym that describes a Linux operating system, with an Nginx web server. The backend data is stored in MySQL and the dynamic processing is handled by PHP.
In this guide, we will demonstrate how to install a LEMP stack on an Ubuntu 14.04 server. The Ubuntu operating system takes care of the first requirement. We will describe how to get the rest of the components up and running.
Note: The LEMP Stack can be installed automatically on your Droplet by adding this script to its User Data when launching it. Check out this tutorial to learn more about Droplet User Data.

Prerequisites

Before you complete this tutorial, you should have a regular, non-root user account on your server with sudo privileges. You can learn how to set up this type of account by completing steps 1-4 in our Ubuntu 14.04 initial server setup.
Once you have your account available, sign into your server with that username. You are now ready to begin the steps outlined in this guide.

Step One — Install the Nginx Web Server

In order to display web pages to our site visitors, we are going to employ Nginx, a modern, efficient web server.
All of the software we will be getting for this procedure will come directly from Ubuntu's default package repositories. This means we can use the apt package management suite to complete the installation.
Since this is our first time using apt for this session, we should start off by updating our local package index. We can then install the server:
sudo apt-get update
sudo apt-get install nginx
In Ubuntu 14.04, Nginx is configured to start running upon installation.
You can test if the server is up and running by accessing your server's domain name or public IP address in your web browser.
If you do not have a domain name pointed at your server and you do not know your server's public IP address, you can find it by typing one of the following into your terminal:
ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//'
111.111.111.111
fe80::601:17ff:fe61:9801
Or you could try using:
curl http://icanhazip.com
111.111.111.111
Try one of the lines that you receive in your web browser. It should take you to Nginx's default landing page:
http://server_domain_name_or_IP
Nginx default page
If you see the above page, you have successfully installed Nginx.

Step Two — Install MySQL to Manage Site Data

Now that we have a web server, we need to install MySQL, a database management system, to store and manage the data for our site.
You can install this easily by typing:
sudo apt-get install mysql-server
You will be asked to supply a root (administrative) password for use within the MySQL system.
The MySQL database software is now installed, but its configuration is not exactly complete yet.
First, we need to tell MySQL to generate the directory structure it needs to store its databases and information. We can do this by typing:
sudo mysql_install_db
Next, you'll want to run a simple security script that will prompt you to modify some insecure defaults. Begin the script by typing:
sudo mysql_secure_installation
You will need to enter the MySQL root password that you selected during installation.
Next, it will ask if you want to change that password. If you are happy with your MySQL root password, type "N" for no and hit "ENTER". Afterwards, you will be prompted to remove some test users and databases. You should just hit "ENTER" through these prompts to remove the unsafe default settings.
Once the script has been run, MySQL is ready to go.

Step Three — Install PHP for Processing

Now we have Nginx installed to serve our pages and MySQL installed to store and manage our data, but we still need something to connect these two pieces and to generate dynamic content. We can use PHP for this.
Since Nginx does not contain native PHP processing like some other web servers, we will need to install php5-fpm, which stands for "fastCGI process manager". We will tell Nginx to pass PHP requests to this software for processing.
We can install this module and will also grab an additional helper package that will allow PHP to communicate with our database backend. The installation will pull in the necessary PHP core files. Do this by typing:
sudo apt-get install php5-fpm php5-mysql

Configure the PHP Processor

We now have our PHP components installed, but we need to make a slight configuration change to make our setup more secure.
Open the main php5-fpm configuration file with root privileges:
sudo nano /etc/php5/fpm/php.ini
What we are looking for in this file is the parameter that sets cgi.fix_pathinfo. This will be commented out with a semi-colon (;) and set to "1" by default.
This is an extremely insecure setting because it tells PHP to attempt to execute the closest file it can find if a PHP file does not match exactly. This basically would allow users to craft PHP requests in a way that would allow them to execute scripts that they shouldn't be allowed to execute.
We will change both of these conditions by uncommenting the line and setting it to "0" like this:
cgi.fix_pathinfo=0
Save and close the file when you are finished.
Now, we just need to restart our PHP processor by typing:
sudo service php5-fpm restart
This will implement the change that we made.

Step Four — Configure Nginx to Use our PHP Processor

Now, we have all of the required components installed. The only configuration change we still need to do is tell Nginx to use our PHP processor for dynamic content.
We do this on the server block level (server blocks are similar to Apache's virtual hosts). Open the default Nginx server block configuration file by typing:
sudo nano /etc/nginx/sites-available/default
Currently, with the comments removed, the Nginx default server block file looks like this:
server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    root /usr/share/nginx/html;
    index index.html index.htm;

    server_name localhost;

    location / {
        try_files $uri $uri/ =404;
    }
}
We need to make some changes to this file for our site.
  • First, we need to add an index.php option as the first value of our index directive to allow PHP index files to be served when a directory is requested.
  • We also need to modify the server_name directive to point to our server's domain name or public IP address.
  • The actual configuration file includes some commented out lines that define error processing routines. We will uncomment those to include that functionality.
  • For the actual PHP processing, we will need to uncomment a portion of another section. We will also need to add a try_files directive to make sure Nginx doesn't pass bad requests to our PHP processor.
The changes that you need to make are in red in the text below:
server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    root /usr/share/nginx/html;
    index index.php index.html index.htm;

    server_name server_domain_name_or_IP;

    location / {
        try_files $uri $uri/ =404;
    }

    error_page 404 /404.html;
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root /usr/share/nginx/html;
    }

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}
When you've made the above changes, you can save and close the file.
Restart Nginx to make the necessary changes:
sudo service nginx restart

Step Five — Create a PHP File to Test Configuration

Your LEMP stack should now be completely set up. We still should test to make sure that Nginx can correctly hand .php files off to our PHP processor.
We can do this by creating a test PHP file in our document root. Open a new file called info.php within your document root in your text editor:
sudo nano /usr/share/nginx/html/info.php
We can type this into the new file. This is valid PHP code that will return formatted information about our server:

When you are finished, save and close the file.
Now, you can visit this page in your web browser by visiting your server's domain name or public IP address followed by /info.php:
http://server_domain_name_or_IP/info.php
You should see a web page that has been generated by PHP with information about your server:
PHP page info
If you see a page that looks like this, you've set up PHP processing with Nginx successfully.
After you test this, it's probably best to remove the file you created as it can actually give unauthorized users some hints about your configuration that may help them try to break in. You can always regenerate this file if you need it later.
For now, remove the file by typing:
sudo rm /usr/share/nginx/html/info.php

Conclusion

You should now have a LEMP stack configured on your Ubuntu 14.04 server. This gives you a very flexible foundation for serving web content to your visitors.

Thursday, December 10, 2015

Best Actors

1                    John Wayne        1907-05-26
                           
2                    James Stewart        1908-05-20
                           
3                    Tom Hanks        1956-07-09
                           
4                    Harrison Ford        1942-07-13
                           
5                    Clint Eastwood        1930-05-31
                           
6                    Cary Grant        1904-01-18
                           
7                    Leonardo DiCaprio        1974-11-11
                           
8                    Jeff Bridges        1949-12-04
                           
9                    Humphrey Bogart        1899-12-25
                           
10                    Matt Damon        1970-10-08
                           
11                    Brad Pitt        1963-12-18
                           
12                    Robert De Niro        1943-08-17
                           
13                    Johnny Depp        1963-06-09
                           
14                    Tom Cruise        1962-07-03
                           
15                    Robert Duvall        1931-01-05
                           
16                    Paul Newman        1925-01-26
                           
17                    George Clooney        1961-05-06
                           
18                    Anthony Hopkins        1937-12-31
                           
19                    Bill Murray        1950-09-21
                           
20                    Denzel Washington        1954-12-28
                           
21                    Tommy Lee Jones        1946-09-15
                           
22                    Michael Caine        1933-03-14
                           
23                    Gene Hackman        1930-01-30
                           
24                    Mel Gibson        1956-01-03
                           
25                    Al Pacino        1940-04-25
                           
26                    Christian Bale        1974-01-30
                           
27                    Bruce Willis        1955-03-19
                           
28                    Viggo Mortensen        1958-10-20
                           
29                    Morgan Freeman        1937-06-01
                           
30                    Robin Williams        1951-07-21
                           
31                    Spencer Tracy        1900-04-05
                           
32                    Gary Oldman        1958-03-21
                           
33                    Heath Ledger        1979-04-04
                           
34                    Liam Neeson        1952-06-07
                           
35                    Michael Fassbender        1977-04-02
                           
36                    Woody Harrelson        1961-07-23
                           
37                    Alan Alda        1936-01-28
                           
38                    Will Smith        1968-09-25
                           
39                    Kevin Costner        1955-01-18
                           
40                    Jack Lemmon        1925-02-08
                           
41                    Charles Chaplin        1889-04-16
                           
42                    Jack Nicholson        1937-04-22
                           
43                    Russell Crowe        1964-04-07
                           
44                    Philip Seymour Hoffman        1967-07-23
                           
45                    Gary Cooper        1901-05-07
                           
46                    Kevin Spacey        1959-07-26
                           
47                    Ed Harris        1950-11-28
                           
48                    Henry Fonda        1905-05-16
                           
49                    Burt Lancaster        1913-11-02
                           
50                    Kirk Douglas        1916-12-09
                           
51                    Javier Bardem        1969-03-01
                           
52                    Chris Cooper        1951-07-09
                           
53                    Samuel L. Jackson        1948-12-21
                           
54                    Tom Wilkinson        1948-02-05
                           
55                    Geoffrey Rush        1951-07-06
                           
56                    Dustin Hoffman        1937-08-08
                           
57                    Steve Carell        1962-08-16
                           
58                    Donald Sutherland        1935-07-17
                           
59                    Christopher Plummer        1929-12-13
                           
60                    Marlon Brando        1924-04-03
                           
61                    Gregory Peck        1916-04-05
                           
62                    Don Cheadle        1964-11-29
                           
63                    Lionel Barrymore        1878-04-28
                           
64                    John Candy        1950-10-31
                           
65                    Colin Firth        1960-09-10
                           
66                    Christopher Walken        1943-03-31
                           
67                    John C. Reilly        1965-05-24
                           
68                    Nick Nolte        1941-02-08
                           
69                    Sean Penn        1960-08-17
                           
70                    Edward Norton        1969-08-18
                           
71                    William H. Macy        1950-03-13
                           
72                    Patrick Stewart        1940-07-13
                           
73                    James Cromwell        1940-01-27
                           
74                    Joaquin Phoenix        1974-10-28
                           
75                    Kevin Kline        1947-10-24
                           
76                    Robert Downey Jr.        1965-04-04
                           
77                    Jeremy Irons        1948-09-19
                           
78                    John Goodman        1952-06-20
                           
79                    William Powell        1892-07-29
                           
80                    Will Ferrell        1967-07-16

Wednesday, December 09, 2015

Best Actresses









1



Meryl Streep
1949-06-22








2



Cate Blanchett
1969-05-14








3



Natalie Portman
1981-06-09








4



Kate Winslet
1975-10-05








5



Julia Roberts
1967-10-28








6



Sigourney Weaver
1949-10-08








7



Katharine Hepburn
1907-05-12








8



Audrey Hepburn
1929-05-04








9



Bette Davis
1908-04-05








10



Julianne Moore
1960-12-03








11



Judi Dench
1934-12-09








12



Naomi Watts
1968-09-28








13



Maggie Smith
1934-12-28








14



Keira Knightley
1985-03-26








15



Frances McDormand
1957-06-23








16



Sandra Bullock
1964-07-26








17



Jodie Foster
1962-11-19








18



Nicole Kidman
1967-06-20








19



Susan Sarandon
1946-10-04








20



Helen Mirren
1945-07-26








21



Laura Linney
1964-02-05








22



Scarlett Johansson
1984-11-22








23



Kathy Bates
1948-06-28








24



Annette Bening
1958-05-29








25



Marion Cotillard
1975-09-30








26



Olivia de Havilland
1916-07-01








27



Emma Thompson
1959-04-15








28



Renée Zellweger
1969-04-25








29



Joan Crawford
1905-03-23








30



Jessica Chastain
1977-03-24








31



Anne Hathaway
1982-11-12








32



Maureen O'Hara
1920-08-17








33



Hilary Swank
1974-07-30








34



Cameron Diaz
1972-08-30








35



Jennifer Lawrence
1990-08-15








36



Sissy Spacek
1949-12-25








37



Toni Collette
1972-11-01








38



Amy Adams
1974-08-20








39



Uma Thurman
1970-04-29








40



Tilda Swinton
1960-11-05








41



Jennifer Connelly
1970-12-12








42



Catherine O'Hara
1954-03-04








43



Marisa Tomei
1964-12-04








44



Charlize Theron
1975-08-07








45



Gwyneth Paltrow
1972-09-27








46



Sally Field
1946-11-06








47



Rene Russo
1954-02-17








48



Meg Ryan
1961-11-19








49



Lauren Bacall
1924-09-16








50



Michelle Williams
1980-09-09








51



Helena Bonham Carter
1966-05-26








52



Juliette Lewis
1973-06-21








53



Imelda Staunton
1956-01-09








54



Ellen Burstyn
1932-12-07








55



Ingrid Bergman
1915-08-29








56



Joan Allen
1956-08-20








57



Myrna Loy
1905-08-02








58



Jennifer Aniston
1969-02-11








59



Michelle Pfeiffer
1958-04-29








60



Kristin Scott Thomas
1960-05-24








61



Elizabeth Banks
1974-02-10








62



Cloris Leachman
1926-04-30








63



Rachel Weisz
1970-03-07








64



Elizabeth Taylor
1932-02-27








65



Diane Keaton
1946-01-05








66



Kirsten Dunst
1982-04-30








67



Helen Hunt
1963-06-15








68



Donna Reed
1921-01-27








69



Joan Fontaine
1917-10-22








70



Margo Martindale
1951-07-18








71



Patricia Clarkson
1959-12-29








72



Salma Hayek
1966-09-02








73



Angelina Jolie
1975-06-04








74



Catherine Zeta-Jones
1969-09-25








75



Minnie Driver
1970-01-31








Sunday, December 06, 2015

20 million Nintendo NX in 2016

A much-maligned Digitimes report is actually far from crazy; Nintendo's historical data suggests that a 20 million target for NX is plausible
Nintendo

The hefty pinch of salt required alongside any article from Taiwanese news site Digitimes is fairly well known - and has been regularly mentioned in articles covering the site's apparent 'scoop' of manufacturing numbers for the Nintendo NX console this week. The site does have great sources within Taiwan and China's extensive manufacturing industries, and has on occasion released major scoops regarding products from Apple, among others - but it buries those gems in a torrent of articles that are far more dubious, and its misses are easily as numerous as its hits.

Thanks to this reputation, the Nintendo story has been greeted with outright skepticism - but some of that skepticism is unfounded, and in reality, Digitimes' numbers are probably reasonably accurate. The 20 million target for first-year sales of NX has come in for particular criticism, with many commentators claiming that this is ludicrously high - but in fact, a look at Nintendo's historic sales figures suggests that this is almost certainly the right ballpark for the high end of the company's internal sales targets.

"With the NX, it stands to reason that Nintendo would be targeting the kind of sales achieved by the Wii, not the sales of the disappointing Wii U; if you're not even going to try to match or exceed the sales of your best-selling products, why bother at all?"

For a start, let's bear in mind that Nintendo, like most companies, thinks in terms of financial years - so if we assume a 2016 launch for the NX, as has been widely reported elsewhere, the company's first-year projections would include everything up to March 31st, 2017. If the console launches in early 2016, as we've seen historically with the 3DS and the Game Boy Advance - both of which were spring or early summer launches - then the "year one" prediction will map nicely on to the 2017 financial year; if it launches late in 2016 (as is far more likely, of course), then the "year one" prediction will include a chunk of FY2017 and the lion's share of FY2018.

It's important to think about this in terms of financial years for two reasons - because that's how Nintendo thinks (and any internal projections Digitimes may have seen will be done in terms of quarters and financial years, not calendar years), and because it allows us to go back through the company's financial records and see how that 20 million figure might stack up with sales of previous consoles. In short - is, as some commentators are claiming, 20 million a ludicrous target for a Nintendo console after its first full financial year on the market?

Let's look at home consoles first, as the NX is hypothetically positioned as the successor to the company's failing Wii U. There's no doubt that Nintendo has had its struggles in this sector; the Wii U only managed 6.2 million sales by the end of its first full financial year, fewer even than the GameCube, which sold 9.6 million consoles in that timeframe. However, in between those two consoles we find the all-conquering Wii, which sold a jaw-dropping 24.5 million consoles by the end of its first full financial year. With the NX, it stands to reason that Nintendo would be targeting the kind of sales achieved by the Wii, not the sales of the disappointing Wii U; if you're not even going to try to match or exceed the sales of your best-selling products, why bother at all?

Besides, the Wii may look like an aberration among the company's home console sales figures, but when you look at Nintendo's comparable handheld sales, things start to line up far more nicely. By the end of a full financial year on the market, the GameBoy Advance had racked up 18.2 million unit sales; the Nintendo DS was on 16.7 million units; and the 3DS, despite a rocky start, hit 17.1 million unit sales by the end of FY2012 (and actually had less time to reach that figure than its predecessors, thanks to its March launch window).

In other words, while 20 million is on the high side (and again, this is a target figure), it's within the ballpark of four out of the past six Nintendo console launches. If the company is seeking to recapture its past success, it's almost exactly the figure you'd expect it to pick - and it also, incidentally, looks interesting in the context of the much-vaunted idea that NX will bridge the firm's handheld and home console efforts. 20 million is a tough figure for a Nintendo home console to hit, but apparently no sweat for a well-received Nintendo handheld device; if NX is both, and has a better launch (and more realistic pricing) than the 3DS did, 20 million in the first full fiscal year is totally credible.

What, then, of the other claim in the Digitimes article - that the company's suppliers are basing their estimates on 10 to 12 million units instead? Well, that makes sense too, given the company's recent struggles and the particularly negative press around the Wii U. The contracts between Nintendo and its suppliers will be flexible and include a significant element of risk on the supply side; Nintendo doesn't want to end up with the parts for 20 million consoles sitting in a warehouse if it only manages to sell half that number. Thus, Nintendo will tell suppliers their targets, and suppliers will come up with their own estimates based on those targets and their own analysis of the market in order to balance their supply chains. One downside of this, incidentally, is that if the NX does have Wii-like levels of demand, it may also face Wii-like supply shortages, since Nintendo's suppliers (in the scenario outlined by Digitimes) could end up scrambling to meet their component commitments.

In short, while I'm perfectly happy to take my pinch of salt along with this article (in fact, I set out researching it with a high degree of skepticism, and was only convinced of its reasonability by the data itself), I think it passes the face validity test. Assuming, and this is of course the big "if", that Nintendo is ramping up towards a launch some time in the latter half of 2016, then the targets, projections and timelines Digitimes has outlined are absolutely in line with what you'd reasonably expect from a company in this position.

"The core appeal of NX must be 'buy this as well as a PS4', not 'buy this instead of a PS4'"

One interesting thing to take away from this, however, is to think about the potential relative position of NX against its competition should it meet the targets being laid out. By the time the NX reaches Nintendo's ambitious 20 million target, or its suppliers' more conservative 10 to 12 million target, one would expect PS4 to be comfortably above 50 million (and perhaps closer to 60), and on the current trajectory, the Xbox One should be in or around 40 million. Those figures could change dramatically - there are signs of Xbox One starting to challenge the PS4 more seriously in some markets now - but the ballpark is reasonable; there'll be somewhere around 100 million "current-gen" devices from Microsoft and Sony in the market.

I've argued before that Nintendo could benefit hugely from a "mid-cycle" launch for the NX; if the console is different enough from the Xbox and PlayStation offerings, it would be positioned to be the "second console" of a massive market of existing console owners who have had their system for a few years and are keen to try something else. It wouldn't become their primary gaming device, most likely, but would be valued for its unusual features and its exclusive software, especially if that software included experiences that simply couldn't be accomplished on other consoles. These figures, I think, drive home the core of that message; Nintendo will be launching into a market with a two extremely powerful players, and while some people will of course prefer a Nintendo console to anything else on the market (my rough back of the envelope based on prior sales figures says this is a market of about 3 million people), the core appeal of NX must be "buy this as well as a PS4", not "buy this instead of a PS4".

This also, incidentally, all but shuts down the conversation regarding third-party, cross-platform support. If it hits its targets, the NX will be a great market for third parties who want to develop something original and uniquely suited to the platform - just as the DS, 3DS and Wii have been - but it's going to be a barren wasteland for people who just want to do a cheap port and add another SKU to their upcoming mega-release. It may well rival the technical prowess of Sony and Microsoft's consoles, but it doesn't matter; the installed base, the friends networks and all the rest of it will still be on PlayStation and Xbox, and the cost of porting and releasing on NX will be simply unjustifiable for most games.

Nintendo won't lose much sleep over that. If they can come close to that 20 million target, they'll have exactly what they want - a system that's on a healthy sales trajectory and that provides a solid, high-spending market for the company's exclusive first-party releases, with occasional third-party games filling in the gaps. It won't trouble Sony's market share or leave Microsoft fearing for their second-place position, at least not for a good while, but these numbers would put Nintendo back on a sure footing in the home console market - and that would be good news not just for the House of Mario, but for the industry as a whole.

Sunday, November 29, 2015

My Youtube did something ahead of its time

AN FRANCISCO — More people watch football on TV than play it. The same may be true for video games one day.
That may sound ludicrous to people who believe that playing a game is a lot more fun than watching somebody else do it, but that’s the prediction from a panel of esports advocates in a session at Casual Connect, a large conference on gaming in San Francisco.
Matt Patrick, the president of Theorist and creator of The Game Theorists channel on YouTube, has more than 45 million viewers a month on his channels. The size of his audience already sort of proves the point. Based on a poll he took of viewers, he noted that the Five Nights at Freddy’s, a horror title set in a Chuck E. Cheese’s-like setting, is a case where he believes more people are watching funny viral videos about the game."You are already there, and you should not be scare of this,” Patrick said. “Look at basketball. Some enjoy watching and engaging as a fan. A small subset played Five Nights at Freddy’s, but a huge number are engaging and buying things. They are sharing and talking about it. There are ways to monetize people who aren’t playing your games.”
“I believe the industry will accelerate in growth because there will be a lot more viewers than gamers,” said Peter Warman, the chief executive of market researcher Newzoo and moderator of the panel discussion.
Valve’s finals for the Dota 2 International Championships, which awarded $18 million for its top winners, drew tens of millions of viewers. But esports do have a long way to go before spectators obviously outnumber the players. And much of the time, it’s hard for newcomers to understand what is happening in a fast-paced game at first.
“It happens when games become understandable enough,” said Super Evil Megacorp chief operating officer Kristian Segerstrale, whose studio made the Vainglory mobile multiplayer online battle arena (MOBA) game. “Everyone has bounced a basketball. If you get to a game that is understandable after you watch it once, then we will get there. ”
He noted that in the course of a few months, Vainglory’s viewership on gameplay livestreaming site Twitch tripled in a few months.
“Our dream is to make the world’s first truly mass market esport,” Segerstrale said.