user  www-data;
worker_processes  1;
error_log  /var/log/nginx/error.log warn;

events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;
    log_format main      '$remote_addr - - [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent"'
    log_format combined  '$remote_addr - - [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" "$http_host" $request_time "$http_x_forwarded_for" "$http_via" "$gzip_ratio"'; 
    access_log	/var/log/nginx/access.log combined;

    sendfile        on;
    keepalive_timeout  65;
    tcp_nodelay        on;

    server {
        listen       80;

        charset off;

        location / {
        root   /home/site/www/;
        index  index.html index.htm index.php;        
    }

    location ~ \.php$ {
        proxy_pass   http://127.0.0.1:81;
      proxy_redirect     off;
        proxy_set_header   Host             $host;
	    proxy_set_header   X-Real-IP        $remote_addr;
	    proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
	access_log   off;
    }
    
    location ~* ^.+\.(jpg|jpeg|gif)$ {
        root   /home/site/www/;
	access_log   off;
	expires      30d;
    }
						
        error_page   500 502 503 504  /nginx-errors/50x.html;

        location ~* ^.+\.fcgi {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.fcgi;
            fastcgi_param  SCRIPT_FILENAME  /var/www/cpp$fastcgi_script_name;
            include        /etc/nginx/fastcgi_params;
        }

        location /doc {
            root /usr/share;
            autoindex on;
            allow 127.0.0.0/8;
            deny all;
        }
    }
}
