Nginx hosting with path appended to index.php

ironkeith asked:

I’m hosting an instance on Concrete5, and in addition to using a dynamic paths, they also use URLs in the weird form of

I have it mostly working, but I’m having issues getting Nginx to serve requests to, as it’s listing the directory instead of displaying index.php.

  • -> lists the public directory, but should display index.php
  • -> works!
  • -> works!

Here’s my Nginx conf file:

server {

    root /srv/www/;

    location / {
        try_files $uri $uri/ /index.php/$request_uri;
        autoindex on; # just for debugging...

    location ~ \.php($|/) {
        set $script $uri;
        if ($uri ~ "^(.+\.php)(/.+)") {
            set $script $1;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$script;
        fastcgi_intercept_errors on;
        fastcgi_pass  unix:/var/run/php5-fpm.sock;


My answer:

Your configuration is missing index index.php;.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.