nginx default template

server {
        server_name www.yourdomainname.com;
        return 301 $scheme://yourdomainname.com$request_uri;
}

server {
        listen 80;
        server_name yourdomainname.com;

        root /var/www;
        index index.php index.html index.htm;

        location / {
            try_files $uri $uri/ /index.php$is_args$args;
        }

        location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
            expires 1y;
            log_not_found off;
        }

        location ~ \.php$ {
            try_files $uri /index.php =404;
            fastcgi_pass unix:/var/run/php5-fpm.sock;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
        }
}