@ medsha
You are using a lot unwanted code.
Try following config:
server {
server_name example.com www.example.com;
access_log /var/log/nginx/example.com.access.log;
error_log /var/log/nginx/example.com.error.log;
root /var/www/example.com/htdocs;
index index.php;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
}
For more details, refer to http://rtcamp.com/wordpress-nginx/tutorials/
Also you can use http://wordpress.org/extend/plugins/nginx-helper/ for removing index.php from permalinks