I am trying to get a site on nginx running based on codeigniter. Some parts work but some fail. I noticed in access logs that index.php sometimes has two slashes at the end insted of one I am also failing to get my post correctly (returns 404).
my conf for nginx is as follows for my default site (it's the only one on server)
server {
server_name xxx.com;
return 301 $scheme://www.xxx.com$request_uri;
}
server {
root /srv/www/xxx;
index index.php index.html index.htm;
server_name www.xxx.com;
# removes trailing "index" from all controllers
if ($request_uri ~* index/?$)
{
rewrite ^/(.*)/index/?$ /$1 permanent;
}
if (!-e $request_filename)
{
rewrite ^(.*)$ /index.php/$1 last;
break;
}
location \ {
try_files $uri $uri/ @no_php_ext;
}
# catch all
error_page 404 /index.php;
location ~ \.(php)$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
# With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /srv/www/xxx/$fastcgi_script_name;
include fastcgi_params;
#fastcgi_read_timeout 900;
}
location @no-php-ext {
rewrite ^(.*)$ index.php/$1 last;
}
}
I have tried many changes in the rewrites but with no success. Any help is really appreciated.