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 {
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;

    # pass the PHP scripts to FastCGI server listening on
location ~ .php {
fastcgi_param SCRIPT_FILENAME
include fastcgi_params; # many things here

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