Install PHP-FPM/Nginx on Fedora 16/15/14

by Manoj 2012-06-16 10:28:44

Install Nginx with PHP 5.3.10 and PHP-FPM on Fedora 16/15/14

PHP-FPM is easier to use and configure than FastCGI and some tests says that PHP-FPM is even much more efficient than FastCGI.

Nginx (engine x) is a robust, small and high performance http server, reverse proxy server and also mail proxy server.

PHP-FPM (FastCGI Process Manager) is an alternative PHP FastCGI implementation with some additional features useful for sites of any size, especially busier sites.

1. Change to root user

sudo -i

##OR##

su

2. Install repositories

Remi Dependency on Fedora 16, 15, 14

rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm

rpm -Uvh http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm

Fedora 16

rpm -Uvh http://rpms.famillecollet.com/remi-release-16.rpm

Fedora 15

rpm -Uvh http://rpms.famillecollet.com/remi-release-15.rpm

Fedora 14

rpm -Uvh http://rpms.famillecollet.com/remi-release-14.rpm

3. Install Nginx, PHP 5.3.10 and PHP-FPM

Fedora 16

yum install nginx php php-fpm php-common

Fedora 15/14

yum –enablerepo=remi install nginx php php-fpm php-common

4. Install PHP 5.3.10 modules

PHP 5.3.10 modules

APC (php-pecl-apc)

CLI (php-cli)

PEAR (php-pear)

PDO (php-pdo)

MySQL (php-mysql)

PostgreSQL (php-pgsql)

MongoDB (php-pecl-mongo)

SQLite (php-sqlite)

Memcache (php-pecl-memcache)

Memcached (php-pecl-memcached)

GD (php-gd)

XML (php-xml)

MBString (php-mbstring)

MCrypt (php-mcrypt)

To install all these modules on Fedora 16/15/14

yum –enablerepo=remi install php-pecl-apc php-cli php-pear php-pdo php-mysql php-pgsql php-pecl-mongo php-sqlite php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xm

5. Stop Apache server, Start Nginx HTTP server and PHP-FPM (FastCGI Process Manager)

Stop Apache(httpd)

systemctl stop httpd.service

##OR##

service httpd stop

Start Nginx

/etc/init.d/nginx start

##OR##

service nginx start

Start PHP-FPM

/etc/init.d/php-fpm start

##OR##

systemctl start nginx.service

6. Autostart Nginx and PHP-FPM on boot, also prevent httpd (Apache) autostarting on boot

Stop Apache autostarting on boot

systemctl disable httpd.service

##OR##

chkconfig httpd off

Autostart Nginx on boot

chkconfig –add nginx

chkconfig –levels 235 nginx on

Autostart PHP-FPM on boot

chkconfig –add php-fpm

chkconfig –levels 235 php-fpm on

7.Enable Remote Connection to Nginx Web Server

7(A).Edit /etc/sysconfig/iptables file

nano -w /etc/sysconfig/iptables

7(B).Add following line before you COMMIT

-A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT

7(C).Restart Iptables Firewall

service iptables restart

##OR##

/etc/init.d/iptables restart

Tagged in:

842
like
0
dislike
0
mail
flag

You must LOGIN to add comments