Web Server Project -- 02 Setting up MySQL and PHP

preview_player
Показать описание
Here's how to get your database and interpreter set up for hosting an application on the LAMP/LEMP stack (Linux / Apache/Nginx / MySQL / PHP).

This is the second of three videos about how to set up a webserver (and a WordPress blog or website on Linux). In this video, I'll show you how to install and configure a MySQL Database. I'll also show you how to set up PHP and php-fpm (our PHP interpreter and the fastcgi process manager) so that nginx can ask PHP to render pages with dynamic content for website visitors.

This video is quick-and-dirty -- no optimization, only the most basic security precautions, etc...but it should get you started.

Here's the nginx configuration file content for /etc/nginx/sites-available/{yoursite}:

server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;

root /usr/share/nginx/html;

server_name server_domain_name_or_IP;

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

root /usr/share/nginx/html;
}

location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

Рекомендации по теме
Комментарии
Автор

You are doing a really great job sir but I really want to see more.I really really advise you to upload more often.Thanks, and keep up with the good work.

catalinciortea
Автор

Thanks for the videos, really helpful. It would be awesome to see more.

MiroslavGalic
Автор

at 7:20, if I have php7.0 installed, do I still use the "blob" in the description, or do i have to edit it?

vegjpmg
Автор

in PHP 7.2, the default location of home directory is /var/www/html. This trus? I mean when I created a php file and save in this folder it works. But not so when I save the file in /usr/share/nginx/html.

DecemberDawn_
Автор

thx for your video!
please tell, what did you paste to for php go working?

dmytrokostin
Автор

Can you elaborate on one user per website and keeping websites in /var/www

DanielTateNZ
Автор

So i am setting up a raspberry pi web server and wanted to know if you can easily substitute python for php?

BUCKTMN
Автор

Now that PHP7 is out, should we install that instead of 5?

TroyCados
Автор

Hello sir,
I follow this tutoril until end of the tutorial, but at the end i try to access localhost/phpinfo.php and the result is 404 Not Found.
What the error can happen sir? i try with php 7.2

herpanielmangeka
Автор

Can you show us how to install postgresql one day?

aameen
Автор

Hi, can you also please make some video for phpmyadmin or share a nice howto link)

michaelivliev
Автор

I am unable to install php5-fpm from sudo apt-get install php5-fpm. It says:
No installation candidate. I am using ubuntu 16.04

mzw
Автор

i can not install php5 i have a error
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

dr.unknown
Автор

This is not for beginner. The explanation is too fast. Don't use this tutorial if you have no experience at all with apache.

DecemberDawn_
join shbcf.ru