Setup Nginx PHP FPM Percona Mysql

From Brian Nelson Ramblings
Revision as of 01:40, 9 February 2014 by Brian (Talk | contribs)

Jump to: navigation, search

Setup Nginx + php-fpm + Percona Mysql

First we will want to enable the epel repo and percona repos

rpm -Uhv http://www.percona.com/downloads/percona-release/percona-release-0.0-1.x86_64.rpm
rpm -Uhv http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

1) Install Percona Mysql

Lets install Percona56 Server

yum install Percona-Server-server-56 Percona-Server-client-56

To increase performance of INNODB tables lets create separate namespaces

vim /etc/my.cnf

Now add the following line under [mysqld]

[mysqld]
innodb_file_per_table

Lets make sure Percona starts on boot

chkconfig mysql on

Lets Start Percona Server

/etc/init.d/mysql restart

2) Install Nginx

yum install nginx -y

Let nginx to start on boot

chkconfig nginx on

Now lets start nginx

/etc/init.d/nginx start

3) Install PHP-FPM/PHP-CLI

Lets install php-fpm with Yum

yum install php-fpm php-mysql php-mssql

Start php-fpm at boot up

chkconfig php-fpm on

/etc/init.d/php-fpm start

Lets check and make sure there is no issues with php-fpm

php-fpm -v
PHP 5.3.3 (fpm-fcgi) (built: Dec 11 2013 03:17:57)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

If you want the default php -v via the command line we can create a symlink

ln -s /usr/sbin/php-fpm /usr/sbin/php

===4) Configure Nginx to use PHP+FPM

PHP+FPM TCP

PHP+FPM Socket