1

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.

1 Answer 1

0

This one worked for me. All pages are returned with 200 now. I still have probs with cron jobs but that should be asked in a different question.

server { root /srv/www/xxx; index index.php index.html index.htm; server_name www.xxx.com; access_log /var/log/nginx/xxx.access.log; error_log /var/log/nginx/xxx.error.log; location = / { try_files $uri $uri/ /index.php; rewrite ^/(.*)$ /index.php; } location / { # Check if a file or directory index file exists, else route it to index.php. try_files $uri $uri/ /index.php; location = /index.php { fastcgi_pass unix:/var/run/php5-fpm.sock; include fastcgi_params; } } location ~ \.php$ { return 444; } } 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.