Help understanding the correct fast cgi params
Thomas Delonge
lists at ruby-forum.com
Thu Sep 16 17:29:13 MSD 2010
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/.
More information about the nginx
mailing list