I'm doing the following steps and can't seem to have the PHP interpreted. I've done many variants of this, searched the web extensively and shown it to a friend: we don't understand what we do wrong. Could you help?
- Launch RHEL 7.3 Amazon free tier instance
Connect in SSH with mac Terminal app
sudo yum install wget wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm sudo rpm -Uvh epel-release-latest-7*.rpm sudo yum install nginx sudo service nginx restart
open port 80 in rehl instance inbound rules
check http://[my_instance_name].eu-central-1.compute.amazonaws.com/, it displays the welcome to nginx on Fedora page
install php and configure nginx
sudo yum install php-fpm
sudo yum install nano
sudo nano /etc/php.ini, and in the file, set cgi.fix_pathinfo=0
sudo nano /etc/nginx/nginx.conf, and set the worker processes to 4 (value was: auto)
sudo nano /etc/nginx/conf.d/default.conf and have the following conf:
server {
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.php index.html index.htm;
}
error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root /usr/share/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
- configure php
sudo nano /etc/php-fpm.d/www.conf and confirm user and group are php-fpm sudo service php-fpm restart sudo nano /usr/share/nginx/html/info.php containing phpinfo(); (with the php tags, stackoverflow seems to hide it) sudo service nginx restart sudo chkconfig --levels 235 nginx on sudo chkconfig --levels 235 php-fpm on
browse to http://[my_instance_name].eu-central-1.compute.amazonaws.com/info.php : it downloads the php file instead of interpreting it
change step /etc/php-fpm.d/www.conf and say that user and group are nginx, restart nginx, php file still downloaded instead of interpreted
change step /etc/nginx/conf.d/default.conf and say server_name = [IP of my instance], restart nginx, php file still downloaded instead of interpreted
What am I missing?