Just Another Blog

"Simplicity is the key to brilliance.” -Bruce Lee

Home About

Nginx and PHP FPM on Slackware

Steps to install are

wget  http://slackbuilds.org/slackbuilds/14.2/network/nginx.tar.gz

tar -zxvf nginx.tar.gz

cd nginx

wget http://nginx.org/download/nginx-1.7.2.tar.gz

Edit nginx.SlackBuild with the corresponding nginx version which was downloaded

./nginx.SlackBuild

You will have a package file after build Slackware package /tmp/nginx-1.7.2-i486-2_SBo.tgz created.

install it with the installpkg command.

And change mode of the startup script ```chmod +x /etc/rc.d/rc.nginx

For PHP-FPM make the startup script executable by ```chmod +x /etc/rc.d/rc.php-fpm

Edit the file /etc/php-fpm.conf, change catch_workers_output to yes. This will allow you to get meaningful error message in the log.

Edit the file /etc/nginx/nginx.conf

Uncomment the line on related to fastcgi:

location ~ \.php$ {
                   fastcgi_pass  127.0.0.1:9000;
                   fastcgi_index index.php;
                   fastcgi_param SCRIPT_FILENAME
                   $document_root$fastcgi_script_name;
                    include       fastcgi_params;
                    }

Now, fire up the php-fpm and nginx server:

/etc/rc.d/rc.php-fpm start

/etc/rc.d/rc.nginx start

create a test php file /var/www/testphp.php

<?php
phpinfo();
?>