I have the following directory structure:
mysite.com
- /api (codeigniter RESTful API Server)
- /app (backbonejs app)
I'm trying to configure NGINX to point all requests for mysite.com/api* to the api directory and use Codeigniter's setup.
Everything i've found works fine, if CI is in the root directory. But, the moment you try to put it in a sub-directory, it fails.
This is what I currently have:
server {
listen 80;
server_name local.mysite.com;
root /Users/me/Sites/mysite;
autoindex on;
index index.html index.php;
location /api {
try_files $uri $uri/ /api/index.php;
location ~ \.php$ {
root /Users/me/Sites/mysite/api;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
}
Doing this just gives me a 'File not found' error. Not even a proper nginx 404. How do I configure NGINX for CodeIgniter in a subdir of a server?
Thanks!
For anyone else who is trying to figure this out, and failing because no answer is out there yet, here is a super simple setup: