#user  www;
worker_processes  2;
error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    log_format  main  '$host  $remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;
                           



####重定向
              server {
                        listen       80;
                        server_name _;
                        charset utf-8;
                        access_log  logs/newboc888.log  main;
                        location / {

                        rewrite ^/(.*) http://admin.chengshire.com/$1 permanent;
                }
                }


###后端为任何WEB服务

                     server {
                        listen       8000;
                        server_name _;
                        charset utf-8;
                        access_log  logs/acces.log  main;
                   location / {
                                  proxy_pass   http://img.hongma123.com;
                                proxy_set_header   Host             $host;
                                proxy_set_header   X-Real-IP        $remote_addr;
                                proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;                        

                }
                }
 
###后端为CGI服务
   server {
        listen       8008;
        server_name  _;
        root         /opt/nginx/html;
        charset utf-8;
        access_log  logs/host.access.log  main;

    location / {
        try_files $uri $uri/ /index.php$is_args$args;
    	}
    location ~ \.php$ {
        try_files $uri = 404;
        fastcgi_pass   127.0.0.1:9001;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
	    }

	}

}
