Welcome! Log In Create A New Profile

Advanced

Help understanding the correct fast cgi params

Thomas Delonge
September 16, 2010 09:40AM
I got some help on this forum yesterday:
http://www.ruby-forum.com/topic/216989#new

That solved most of my problem; it does pretty much what it should.

The problem now is that all requests get routed to index.php without
passing anything extra. (I use the codeigniter php framework if that
matters.) The way the configuration file is right now everything gets
passed to index.php without any extra info. So no matter what is in the
url, the page that loads is as if you had just put index.php

If I were using apache, I would have a rewrite rule like so:
RewriteRule ^(.*)$ index.php?/$1 [L]

which makes a url be something nice like:

example.com/controller/action

rather than

example.com/index.php/controller/action

Now I also need to do that in nginx, but the script also needs to be
sent to fast cgi (port 9000).

Here's my nginx.conf so far (big thanks to Igor Sysoev for helping me
out a few hours ago. This is the same file from the link I posted at the
beginning (the one Igor Sysoev fixed)):


server {

listen 80; ## listen for ipv4
listen [::]:80 default ipv6only=on; ## listen for ipv6

keepalive_timeout 5 5;

gzip on;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain application/xml
application/x-javascript;

root /var/www/example.com/public/;

location / {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME
/var/www/example.com/public/index.php$fastcgi_script_name;
}

location ~*
^/sqlbuddy/.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$
{
access_log off;
expires 1s;
}

location ~ ^/sqlbuddy/ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME
/var/www/example.com/public/$fastcgi_script_name;
}

location ~*
\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$
{
access_log off;
expires 1s;
}

}
--
Posted via http://www.ruby-forum.com/.

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Help understanding the correct fast cgi params

Thomas Delonge September 16, 2010 09:40AM

Re: Help understanding the correct fast cgi params

Igor Sysoev September 16, 2010 02:54PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 67
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready