Nginx Default Conf

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

server {
        listen   80;
        server_name www.domain.com;

        root /home/demo/domain.com/public;
        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;
        }

        # pass the PHP scripts to FastCGI server listening on /var/run/php5-fpm.sock
        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;
        }
}