Having troubles understanding basic location directives.

Thomas Delonge lists at ruby-forum.com
Thu Sep 16 09:02:59 MSD 2010


So I've got a couple of requirements. If the file is a resource (image,
stylesheet, etc...) then just serve it.

Pretty much everything else should be directed through my index.php file

If the domain has sqlbuddy at the beginning, just use it like normal.
(So if they're going to example.com/sqlbuddy, then it should just run
that without sending it through the special index.php

Also, resources for the sqlbuddy app should be served from the sqlbuddy
root. (Sqlbuddy is just a phpmyadmin substitute)

So the resources seem to be served correctly (I'm downloading images in
my browser correctly). Traffic also is routed through my index.php file.
The problem is getting sqlbuddy to work. I'm just getting a 404 error.
Ideas?

This is what I have so far:


server {

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

  server_name  _;

  location ^~ /sqlbuddy/ {
    root /var/www/example.com/public/sqlbuddy/;
    index index.php;
  }

  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)$
{
        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/;
            access_log off;
            expires 1s;
   }

  location / {
    root /var/www/example.com/public/;
    rewrite ^(.*) /index.php?$1 last;
  }

  location ~ \.php$ {
          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;
  }
}
-- 
Posted via http://www.ruby-forum.com/.



More information about the nginx mailing list