Installing PHP
Now that we have the web server up and running, we can add the PHP processor that we need to be able to add PHP elements to our page and subsequently create dynamic web content. Nginx uses the PHP FastCGI Process Manager, which is again available from the EPEL repository. We have that set up already from the Nginx install and the earlier install of 389-ds. To install PHP and the PHP-FPM, we can use yum
:
# yum install php-fpm
Once installed, we need to edit the FPM so that it uses the correct accounts for Nginx. To do this, we can edit /etc/php-fpm.d/www.conf
. We will need to edit the user and group lines from apache
to nginx
:
user = nginx group = nginx
We also need to make sure that the Nginx web server knows to forward PHP files to the FPM service on port 9000. We can re-edit /etc/nginx/conf.d/main.conf
and add it to the server section:
server { listen 80; root /var/www/html; index index.html; error_page 404 not_found.html; location ~ \.php$ { fastcgi_pass 127.0.0.1...