WEBVTT

00:02.970 --> 00:08.760
When it comes to websites and web applications, many people use the term stack to describe the environment

00:08.760 --> 00:11.640
where these sites and apps are developed and served from.

00:12.180 --> 00:18.600
The typical web server stack consists of four parts and operating system, a web server, a database,

00:18.600 --> 00:20.100
and a scripting language.

00:20.740 --> 00:24.790
For many years, the primary web stack has been the lamp stack.

00:25.400 --> 00:28.190
In this case, Linux is the operating system.

00:28.190 --> 00:29.890
The Web server is Apache.

00:29.900 --> 00:36.890
The database component is my SQL or Maria DB, and the scripting language is either PHP, python or

00:36.890 --> 00:43.460
Perl, with PHP being the one most commonly referred to because the components of the web stack can

00:43.460 --> 00:47.750
be swapped out using jinks for the web server leads to the lunch stack.

00:48.350 --> 00:51.020
The other components remain the same.

00:51.530 --> 00:57.710
In this case, Jenks is represented by the letter E for the Sound of the Jinx name rather than its spelling.

00:58.250 --> 01:05.090
Now let's take a look at getting configured to run dynamic applications with Jinx, Maria, DB and PHP.

01:06.090 --> 01:07.860
To get started with our lymph stack.

01:07.860 --> 01:11.670
I'm already connected to our development team with Jinx installed.

01:12.260 --> 01:17.120
Now let's install PHP, also known as the hypertext preprocessor.

01:18.150 --> 01:23.010
PHP is a general purpose scripting language especially suited to web development.

01:23.580 --> 01:27.270
You can learn more about PHP at PHP dot net.

01:27.810 --> 01:32.760
We'll be working as the route user, so we need to elevate our session with pseudo su dash.

01:33.360 --> 01:38.130
Now we can run apt update to make sure the package repositories are up to date.

01:38.700 --> 01:41.820
And now we can install the PHP packages.

01:42.360 --> 01:47.220
We'll do this with APT, install php, FPM and php mysql.

01:47.790 --> 01:54.330
This will install the PHP fast process manager and any other packages we need for a PHP.

01:54.840 --> 02:01.740
The fast CGI process manager is a service that will process any PHP files received by the web server.

02:02.370 --> 02:03.360
And a PHP.

02:03.360 --> 02:09.090
MySQL package is a package that allows PHP to connect to a MySQL database.

02:09.660 --> 02:15.390
Once the installation is complete, we can check the version of PHP that got installed by running PHP

02:15.390 --> 02:16.140
version.

02:16.710 --> 02:20.760
In this case we'll be using PHP 7.2.5.

02:21.300 --> 02:25.410
Now let's check the PHP fast CGI Process manager.

02:25.990 --> 02:31.330
This gets installed as a service and we can make sure it's up and running with system CTL.

02:31.900 --> 02:33.790
Four php fast cgi.

02:33.820 --> 02:37.510
The name of the service is PHP 7.2 fpm.

02:38.080 --> 02:38.650
Great.

02:38.650 --> 02:42.580
This output tells us that PHP FPM is up and running.

02:43.150 --> 02:48.760
At this point we're ready to configure Jinx so that it can communicate with the PHP service.

02:49.330 --> 02:52.420
So let's edit our conf file for our site.

02:52.960 --> 02:58.810
In the conf file we need to add a location with a case sensitive regular expression that matches URI

02:58.960 --> 03:00.670
ending in PHP.

03:01.180 --> 03:06.880
Next, we'll use the include directive to bring in some code that's stored outside of our config file.

03:07.420 --> 03:14.740
The fast php conf file contains helpful directives that improve the security and efficiency of the site.

03:15.310 --> 03:18.940
Now let's add a fast CGI underscore pass directive.

03:19.450 --> 03:24.900
This directive tells Jinks to use a unique socket to communicate with php fpm.

03:25.480 --> 03:31.690
Communicating through a socket keeps the transfers between jinks and PHP on the local system much faster

03:31.690 --> 03:34.390
than communicating via a TCP port.

03:34.960 --> 03:37.450
We can also add one more directive.

03:38.080 --> 03:38.540
Fast.

03:38.560 --> 03:42.970
CGI underscore, intercept, underscore errors and then add the keyword on.

03:43.480 --> 03:50.470
This tells Jinks that if any errors are returned by the fast CGI server in this case FPM, that jinks

03:50.470 --> 03:53.640
should try to process that error with an error page directive.

03:53.650 --> 04:01.690
If possible, Jinks will consider errors from the fast CGI process as 500 errors, so these will be

04:01.690 --> 04:05.440
handled by our custom 50 x HTML page.

04:05.980 --> 04:09.400
Now let's save the file and test our configuration.

04:09.980 --> 04:11.300
Everything looks good there.

04:11.300 --> 04:14.420
So let's go ahead and reload the configuration.

04:14.930 --> 04:18.710
Now, the only thing we need is some PHP content.

04:19.250 --> 04:24.080
Let's create a PHP info page in the root directory of the demo site.

04:24.650 --> 04:30.590
In this file we'll put some PHP code that will return details about our PHP installation.

04:31.070 --> 04:37.730
These commands will provide details on our PHP installation served as a dynamically generated web page.

04:38.350 --> 04:44.080
I should add that making the PHP info function output available on a web page should only be used for

04:44.080 --> 04:46.150
development and never in production.

04:46.660 --> 04:52.210
The details on the page might give a hacker or otherwise nosy visitor to our site more information about

04:52.210 --> 04:55.450
our site than they need, making it a target for attack.

04:56.070 --> 05:00.240
Now we can go to the browser and test the info page on our demo site.

05:00.780 --> 05:06.660
Now enter 192.168.0.3, which is the IP address for our site.

05:07.200 --> 05:09.630
And then info dot php.

05:10.170 --> 05:11.160
Nice.

05:11.780 --> 05:18.080
Seeing our info page confirms that we have php FPM installed and jinks configured to use it for processing

05:18.080 --> 05:19.940
web pages with PHP.

05:20.480 --> 05:25.680
Let's wrap up the session here and move on to installing the database server for our limp stack.

05:25.700 --> 05:26.990
Maria db.
