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. mydomain.com is my real website, mydomain.com/web 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 mydomain.com/web, but mydomain.com/web/about errors because it can't open /var/www/web/page/about.

Thanks,

server {

root /var/www/tysdomain.com;

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_pass 127.0.0.1:9000;

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

Reply

Please enter an answer
Tips:

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] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct