Rewrite rule for Wordpress

I use the same configuration on localhost and it works, but on the
server the “friendly URLs” doesn’t work anyway.
Time passes and I understand less about the nginx configuration. I’m
looking for a document with good explanation about how it works.

This is my configuration:

server {
server_name colegioosaber.com.br;
root /var/www/osaber; # <---- The root!

    location / {
            root /var/www/osaber;
            index index.php;

            # --> Wordpress configuration for site_osaber
            if (!-e $request_filename) {
                    rewrite  ^(.*)$  /index.php?q=$1  last;
                    break;
            }
    }

    # pass the PHP scripts to FastCGI server listening on 

127.0.0.1:9000
location ~ .php {
fastcgi_param SCRIPT_FILENAME
/var/www/osaber$fastcgi_script_name;
include fastcgi_params; # many things here
}
}

How can I debug nginx configuration setting process to find errors?
Logs?