Web Server Project   02 Setting up MySQL and PHP @tutoriaLinux
Web Server Project   02 Setting up MySQL and PHP  @tutoriaLinux
Uploaded January 2015 | Updated September 2026, 2 weeks ago
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;
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;
}
}


Full Linux Sysadmin Basics Playlist: youtube.com/playlist?list=PLtK75qxsQaMLZSo7KL-PmiRarU7hrpnwK

Check out my project-based Linux System Administration course (free sample videos): udemy.com/hands-on-linux-self-hosted-wordpress-for-linux-beginners/?couponCode=tl35

Patreon: patreon.com/tutorialinux
Official Site: tutorialinux.com
Twitter: twitter.com/tutorialinux
Facebook: facebook.com/tutorialinux
Web Server Project   02 Setting up MySQL and PHPMy 5 Favorite Linux Shell Tricks for SPEEEEEED (and efficiency)The Kubernetes Objects You Need to UnderstandLaunch: A New, Project-Based System Administration CourseBash Scripting 6   If and Testing ExplainedBash Scripting 5   ArgumentsSurvey: Choose the next TutoriaLinux Course TopicProgramming Ruby 10   Functions and AbstractionTutorialinux Is BackProgramming Ruby 09   Loops and IterationWhat Every Sysadmin Needs to Know about Tech DebtMoving from Dev to DevOps
tutoriaLinux |

Web Server Project -- 02 Setting up MySQL and PHP

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER