[eluser]Popcorn[/eluser]
Thought this might of some use to some of you.
Code:
server {
listen 80;
root /var/www/nginx-default/;
access_log /var/log/nginx/localhost.access.log;
index index.php index.html index.htm;
error_page 500 502 503 504 /50x.html;
location /codeigniter/ {
if (-f $request_filename) {
expires max;
break;
}
if (!-e $request_filename) {
rewrite ^/codeigniter/(.*)$ /codeigniter/index.php/$1 last;
}
}
location = /50x.html {
root /var/www/nginx-default;
}
location /codeigniter/index.php {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/nginx-default/codeigniter/index.php;
include fastcgi_params;
}
}
The rules inside the location directive basically says : if the file exists then set the maximum expiration date and output it. This is usually css, images, js, etc ...
Then the second rules states that if the file doesn't exist then we assume it's a codeigniter url and redirect the request to the index.php file with the request string.