Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am attempting to host a Kohana installation on Nginx. The difference is that I am trying to serve it up from a subdirectory as opposed to the web root itself.

The problem: When trying to access the url, http://myproject.tld/Project/Welcome, I am given the error message: No input file specified.

Upon investigation, I noticed that this is in fact being rewritten as http://myproject.tld/index.php/Project/Welcome/ when it should be http://myproject.tld/Project/index.php/Welcome/

as seen here:

2014/01/02 23:10:57 [debug] 20952#0: *30 http copy filter: 0 "index.php/Project/Welcome?"
2014/01/02 23:10:57 [debug] 20952#0: *30 http finalize request: 0, "index.php/Project/Welcome?" a:1, c:1

Now, I understand fully why it is happening. Because I am hosting from a subdirectory that will exist within the request_uri and is appended to the url rewrite. If I were serving from the document root this wouldn't be an issue. What I'm hoping is someone can point me in the correct direction for solving this particular hiccup.

Setup Information:

nginx/1.4.4

Kohana 3.3.1

Server configuration:

server {
    listen   80;
    server_name mydomain.tld;

    access_log /home/<user>/logs/mydomain-access.log;
    error_log /home/<user>/logs/mydomain-error.log debug;

    # main root
    root   /home/<user>/domains/mydomain.tld;
    index index.php index.html;

    location / {
        expires off;
        try_files $uri $uri/;
    }

    # Prevent access to hidden files
    location ~ /\. {
        deny all;
    }

    location /Project/ {
        rewrite ^(.+)$ index.php$request_uri last;
    }

    location ~* \.php {
        fastcgi_pass 127.0.0.1:9000;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param KOHANA_ENV development;
        fastcgi_cache off;
        fastcgi_index index.php;
    }
}
share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.