View Single Post
  #3  
Old 30th July 2012, 13:46
poolet poolet is offline
Junior Member
 
Join Date: Jun 2012
Posts: 15
Thanks: 1
Thanked 2 Times in 1 Post
Default

I have modify default.conf in /etc/nginx/conf.d/default.conf as follow:::

Code:
server {
    listen       80;
    server_name  www.domain.com;
    access_log  /var/log/nginx/access.log  main;
    error_log /var/log/nginx/error.log;
    root   /usr/share/nginx/html;

    location / {
        index  index.php index.html index.htm;
    }
    if (!-e $request_filename) {
        rewrite ^(.+)$ /index.php?q=$1 last;
    }
    location ~ \.php$ {
        set $no_cache ""; 
        if ($request_method !~ ^(GET|HEAD)$) {
            set $no_cache "1";
        }
        if ($no_cache = "1") {
            add_header Set-Cookie "_mcnc=1; Max-Age=2; Path=/";
            add_header X-Microcachable "0";
        }
        if ($http_cookie ~* "_mcnc") {
                    set $no_cache "1";}

        fastcgi_no_cache $no_cache;
        fastcgi_cache_bypass $no_cache;
        access_log /var/log/nginx/access.log cache;
        fastcgi_cache microcache;
        fastcgi_cache_key $server_name|$request_uri;
        fastcgi_cache_valid 404 30m;
        fastcgi_cache_valid any 5m;
        fastcgi_max_temp_file_size 1M;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_param  PATH_INFO          $fastcgi_path_info;
        fastcgi_param  PATH_TRANSLATED    $document_root           $fastcgi_path_info;
        include fastcgi_params;
location ~ /\.ht {
        deny  all;
    }
}

server {
  listen          80;
  server_name     static-css.domain.com;
   index           index.php;
   root   /usr/share/nginx/html;}
And I have also modify nginx.conf at /etc/nginx/nginx.conf as::

Code:
user              nginx;
worker_processes  1;

error_log  /var/log/nginx/error.log;
#error_log  /var/log/nginx/error.log  notice;
#error_log  /var/log/nginx/error.log  info;

pid        /var/run/nginx.pid;

events {
    worker_connections  1024;
}

http {

fastcgi_cache_path /var/cache/nginx2 levels=1:2 keys_zone=microcache:5m max_size=1000m;
log_format cache '$remote_addr - $remote_user [$time_local] "$request" '
'$status $upstream_cache_status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

    include      /etc/nginx/mime.types;
    access_log  /var/log/nginx/access.log;
    sendfile        on;
    #tcp_nopush     on;
    #keepalive_timeout  0;
    keepalive_timeout   2;
    tcp_nodelay        on;
    gzip  on;
    gzip_http_version 1.1;
    gzip_vary on;
    gzip_comp_level 6;
    gzip_proxied any;
    gzip_types text/plain text/html text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript text/x-js;
    gzip_buffers 16 8k;
    gzip_disable "MSIE [1-6]\.(?!.*SV1)";
    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}
Reply With Quote