Do Not Think!!!

Posted
Filed under 01010101
$ sudo vi /etc/nginx/sites-enabled/domain.conf

server {
    server_name domain;

    root /home/ubuntu/domain;
    index index.php;

    # set expiration of assets to MAX for caching
    location ~* \.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$ {
        access_log off;
        log_not_found off;
        expires 360d;
    }

    # static contents
    if ($request_uri ~* ^/(images|css|js|font)/) {
        rewrite ^(.*$) /www/$1;
        break;
    }

    # unless the request is for a valid file (image, js, css, etc.), send to bootstrap
    if (!-e $request_filename) {
        rewrite ^/(.*)$ /index.php?/$1 last;
        break;
    }

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

    location ~* \.php$ {
        fastcgi_pass   unix:/var/run/php5-fpm.sock;
        fastcgi_index   index.php;
        fastcgi_split_path_info ^(.+\.php)(.*)$;
        fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include         fastcgi_params;
    }

    # deny access to hidden files
    location ~ /\. {
        access_log off;
        log_not_found off;
        deny all;
    }
}