Try_files does not hit PHP ( NginX configuration)

nginx, php

Solution

Solution was to add index index.php

    index index.php

    try_files $uri $uri/ $uri/index.php /index.php;

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

Problem

Below is my nginx.conf. In case of non existing files `/index.php` is served fine. But when my URL is `/foo/bar => /foo/bar/index.php` is served as PHP source code via download. Any ideas? ``` try_files $uri $uri/ $uri/index.php /index.php; location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } ```

Original source