I am trying to use PHP in my machine. I have nginx server running few other servers along.
Due to curiosity on how to use PHP , i tried to install php-cli and php5-fpm.
The nginx file below seems to work , however on front-end i get the error " 404". When i checked the error log , i found the error
"2016/03/29 14:28:50 [error] 19752#0: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: ::1, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "localhost:84"
So i am assuming either my php5-fpm configuration is wrong or my nginx config is wrong .
Here is my nginx configuration file:
server {
listen 84 default_server;
listen [::]:84 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.html index.htm;
server_name localhost;
location / {
index index.php index.html index.htm;
root /home/sijan/personal/php_site;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
#fastcgi_split_path_info ^(.+\.php)(/.+)$;
#fastcgi_pass unix:/var/run/php5-fpm.sock;
#fastcgi_index index.php;
#include fastcgi_params;
}
}
I followed the following link from Digital Oceans and skip few steps to install MySQL since i will be using psql.
Any Help will be Highly appreciated.
index.php,index.html,index.htm) acutally exist in the configured location (/home/sijan/personal/php_site).index.htmlfile then most likely your nginx setup is fine. So you will have to check deeper if your php setup is actually usable. Try executing some script an CLI to see if that works.