configuring nginx to work with code igniter app

hello all:

I have the following nginx configuration. I'm trying (vainly apparently) to configure it so that it works with code igniter. is my real website, is the app I'm trying to make work. Eventually I'll move the app to the root, but it's a workup of my current site using ci.

I can access, but errors because it can't open /var/www/web/page/about.


server {

root /var/www/;

index index.html index.htm index.php;

location / {


location /web {

try_files index.php;


location ~* .(ico|png|css|js|jpg|jpgeg)$ {

expires max;

lognotfound off;


location ~ .php$ {

try_files $uri = 404;

include /etc/nginx/fastcgi_params;


fastcgi_index index.php;

fastcgiparam SCRIPTFILENAME $documentroot$fastcgiscript_name;



1 Reply

You probably want try_files $uri /web/index.php; it'll try the uri first i.e. if there is a static resource under web then pass everything else to /web/index.php


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct