I have installed nginx, php-fpm and php56 on OS X EL CAPITAN
. I used ps
command to check whether nginx and fpm is running or not.
I have added the below code block to server
block in nginX:
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;
}
nginX listen on 8080
and fpm on 9000
. I used lsof
command to check that:
php-fpm 22903 root 0u IPv4 0x5a9bc9209264e227 0t0 TCP 127.0.0.1:9000 (LISTEN)
php-fpm 22904 fc 0u IPv4 0x5a9bc9209264e227 0t0 TCP 127.0.0.1:9000 (LISTEN)
nginx 22931 fc 6u IPv4 0x5a9bc9208c304cc7 0t0 TCP *:8080 (LISTEN)
nginx 22932 fc 6u IPv4 0x5a9bc9208c304cc7 0t0 TCP *:8080 (LISTEN)
Any clue about the issue why nginx downloads php files rather than interpreting them?
EDIT1:
Full nginX configuration:
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 8080;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
location ~ \.php$ {
root /usr/local/var/www/;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}
}
include servers/*;
The URL I have fetched is: http://localhost:8080/info.php
Does anyone has any clue about this issue? I went on every question in stackoverflow
with no success:
http://serverfault.com/questions/563285/nginx-with-php-fpm-downloading-php-files-rather-than-executing-them-on-mac-os-x?rq=1
http://serverfault.com/questions/412079/nginx-php-fpm-php-file-not-found-cant-figure-out-why?rq=1