Installing Nginx With PHP5 (And PHP-FPM) And MySQL On CentOS 6

Salam all .

Now my time to post my article for nginx server.
How to Install nginx php5-fm mysql on centos 6 ?
So it is easy and lets do it
*learning by doing

- Step One

Download Repositry
sudo rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

- Step Two

Installing Mysql
sudo yum install mysql mysql-server

then Run it :
sudo /etc/init.d/mysqld start

Configure Mysql
sudo /usr/bin/mysql_secure_installation

" Press - Enter - and Y  and type your Password " easy -

Testing
mysql -u root -p
Enter password:


- Step Three

Install Nginx Web Server
sudo yum install nginx

Running nginx Web Server
sudo /etc/init.d/nginx start

Configure -
nano /etc/nginx/nginx.conf

" change line - worker_processes 4 -  "
Save and Exit.

Configure Virtual Host
nano /etc/nginx/conf.d/default.conf

" Quote :
       - add index.php On index line
       - Change " Server Name " by your Domain or IP
       - Change the " /usr/share/nginx/html " to " /var/www/ " #your public_html
       - Uncoment " location ~ \.php$ { " ... ... " } "
       - Change root directory under " location ~ \.php$ { " ... ... " } "
       - Change " fastcgi_param " to "fastcgi_param SCRIPT_FILENAME    $document_root$fastcgi_script_name; "
       - Save and Exit . "

Restarting your Nginx Web Server
sudo /etc/init.d/nginx restart

Testing Nginx Web Server
access your server http://192.168.1.20/


- Step Four

Installing php5-fpm
sudo yum --enablerepo=remi install php-fpm php-mysql

Configure php.ini
nano /etc/php.ini

" Uncoment " cgi.fix_pathinfo=1 " and change to " 0 " => Save and Exit "

Configure php5-fpm
sudo nano /etc/php-fpm.d/www.conf

" Repleace user and grup - Apache - with - Nginx "

" Quote :
    [...]
    user : nginx

    [...]

    grup : nginx
    [...] "

Save and Exit.

Then Restart all Service :
/etc/init.d/mysqld restart
/etc/init.d/nginx restart
/etc/init.d/php5-fpm restart

And Now Testing for all :
cd /var/www/
nano info.php

Put the Script :
<?php
phpinfo();
?>

And Now open info.php => http://192.168.1.20/info.php
See my Screen :


- Finishing

Put all Service in startup

sudo chkconfig --levels 235 mysqld on
sudo chkconfig --levels 235 nginx on
sudo chkconfig --levels 235 php-fpm on

Enjoy it :*
Title : Installing Nginx With PHP5 (And PHP-FPM) And MySQL On CentOS 6
Description : Salam all . Now my time to post my article for nginx server. How to Install nginx php5-fm mysql on centos 6 ? So it is easy and lets do ...

0 Response to "Installing Nginx With PHP5 (And PHP-FPM) And MySQL On CentOS 6"

Post a Comment