Nginx multiple apps, and CodeIgniter

Ive been struggling with a No input file specified issue, and Ive been
trying to figure out the routing issue. I am using fast-cgi, nginx
(version
0.7.65) and CI 2.02

http://www.example.net/ci/ /* Works */

http://www.example.net/ci/index.php /* Works */

http://www.example.net/ci/index.php/welcome

/* Put out "No input file specified." - a 404 in access.log */

The reason I see the problem is because I see this in the CI logs for
all
http requests
DEBUG - 2011-06-05 19:47:23 --> No URI present. Default controller set.

I did not want to litter my first post with code, so here is the
pertinent
info presented neatly:

I changed AUTO to others, and no change in behavior.

/home/examples/example.net/public_html/ci/application/config/config.php
#standard configs except for the following:
$config[‘base_url’] = ‘http://www.example.net/ci/’;
$config[‘index_page’] = ‘index.php’;
$config[‘uri_protocol’] = ‘AUTO’;

I tried adding a new loc for /ci and that did not work (i.e got the No
input file specified error) so I took that off to get back to basics.

/etc/nginx/sites-enabled/www.example.net

server {
server_name example.net;
rewrite ^(.) http://www.example.net$1 permanent;
}
server {
listen 80;
server_name www.example.net;
access_log /srv/www/www.example.net/logs/access.log;
error_log /srv/www/www.example.net/logs/error.log debug;
client_max_body_size 3M;
location / {
root /srv/www/www.example.net/public_html;
index index.html index.htm index.php;
if (!-e $request_filename) {
rewrite ^.
$ /index.php last;
}
}
location ~ .php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /srv/www/www.example.net/
public_html$fastcgi_script_name;
}
}

I went through the .httaccess route to remove the index.php, but did not
want to try too many things at once. I would like to get the bare bones
working and then add other layers.

Interestingly, $_SERVER[REQUEST_URI] puts the correct URI, but
$this->uri->uri_string() is blank.

Id be grateful for any advice and thanks in advance.

PS - this is cross posted from another
forumhttp://codeigniter.com/forums/viewthread/190827/,
and I hope it does not offend anyone :slight_smile:

On Sun, 2011-06-05 at 21:25 -0400, zaid tillman wrote:

http://www.example.net/ci/ /* Works */

http://www.example.net/ci/index.php /* Works */

http://www.example.net/ci/index.php/welcome /* Put out "No input file

specified." - a 404 in access.log */

The reason I see the problem is because I see this in the CI logs for
all http requests

DEBUG - 2011-06-05 19:47:23 --> No URI present. Default controller set.
I did not want to litter my first post with code, so here is the
pertinent info presented neatly:

I guess you have to set PATH_INFO.

location ~ \.php$ {
    include /etc/nginx/fastcgi_params;
          fastcgi_pass  127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param  SCRIPT_FILENAME 

/srv/www/www.example.net/public_html$fastcgi_script_name;

}

Try this:

location ~ .php {
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_split_path_info ^(.+.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
}

ciao

Luca

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs