# Nginx multiple apps, and CodeIgniter

**URL:** <https://www.ruby-forum.com/t/nginx-multiple-apps-and-codeigniter/207904>\
**Category:** NGINX\
**Created:** [June 6, 2011, 3:25am UTC](https://www.ruby-forum.com/t/nginx-multiple-apps-and-codeigniter/207904 "2011-06-06T03:25:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [June 6, 2011, 3:25am UTC](https://www.ruby-forum.com/t/nginx-multiple-apps-and-codeigniter/207904/1 "2011-06-06T03:25:35Z")

</div>

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/](http://www.example.net/ci/) /\* Works \*/

# [http://www.example.net/ci/index.php](http://www.example.net/ci/index.php) /\* Works \*/

# [http://www.example.net/ci/index.php/welcome](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/](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](http://example.net);  
rewrite ^(._) [http://www.example.net$1](http://www.example.net$1) permanent;  
}  
server {  
listen 80;  
server\_name [www.example.net](http://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  
forum[http://codeigniter.com/forums/viewthread/190827/](http://codeigniter.com/forums/viewthread/190827/),  
and I hope it does not offend anyone 🙂

---

<div class="post-metadata">

**Author:** ![btillma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/cab0a1/32.png) [@btillma](https://www.ruby-forum.com/u/btillma)\
**Post date:** [June 6, 2011, 2:25pm UTC](https://www.ruby-forum.com/t/nginx-multiple-apps-and-codeigniter/207904/2 "2011-06-06T14:25:43Z")

</div>

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

> # [http://www.example.net/ci/](http://www.example.net/ci/) /\* Works \*/
> 
> # [http://www.example.net/ci/index.php](http://www.example.net/ci/index.php) /\* Works \*/
> 
> # [http://www.example.net/ci/index.php/welcome](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
