#user  nobody;
worker_processes  1;

#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  '$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;

    #gzip  on;

    upstream back-end {
        server localhost:8999;
    }

    ### alipay
     server {
        listen       80;
        server_name  127.0.0.1:8080;

        location / {
            proxy_pass   http://127.0.0.1:8080;
        }
    }

    server {
        listen       81;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

       # location / {
        #    root   html;
         #   index  index.html index.htm;
        #}

	location ^~/interfacegateway/ {
			 if ($request_method = 'OPTIONS') {
				add_header 'Access-Control-Allow-Origin' '*';
				add_header 'Access-Control-Allow-Methods' 'GET, POST,PUT,DELETE, OPTIONS';
				#
				# Custom headers and headers various browsers *should* be OK with but aren't
				#
				add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,token ,sid';
				#
				# Tell client that this pre-flight info is valid for 20 days
				#
				add_header 'Access-Control-Max-Age' 1728000;
				add_header 'Content-Type' 'text/plain; charset=utf-8';
				add_header 'Content-Length' 0;
				return 204;
			 }
     
			add_header 'Access-Control-Allow-Origin' '*';
			add_header 'Access-Control-Allow-Methods' 'GET, POST,PUT,DELETE, OPTIONS';
			add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,token ,sid';
			add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
            proxy_pass http://localhost:8088/;
        }

	location ^~/cmsapi/ {
			 if ($request_method = 'OPTIONS') {
				add_header 'Access-Control-Allow-Origin' '*';
				add_header 'Access-Control-Allow-Methods' 'GET, POST,PUT,DELETE, OPTIONS';
				#
				# Custom headers and headers various browsers *should* be OK with but aren't
				#
				add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,token ,sid, moduleId';
				#
				# Tell client that this pre-flight info is valid for 20 days
				#
				add_header 'Access-Control-Max-Age' 1728000;
				add_header 'Content-Type' 'text/plain; charset=utf-8';
				add_header 'Content-Length' 0;
				return 204;
			 }
     
			add_header 'Access-Control-Allow-Origin' '*';
			add_header 'Access-Control-Allow-Methods' 'GET, POST,PUT,DELETE, OPTIONS';
			add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,token ,sid, moduleId';
			add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
            proxy_pass http://localhost:8082/cmsapi/;
        }

	location ^~/smartPark/ {
		alias E:/rhwl/smartcity/WEB/smartPark/;
        }

        	location ^~/fsCms/ {
		alias E:/rhwl/smartcity/WEB/fsCms/;
        }

           location ^~/sthy/ {
		alias E:/rhwl/smartcity/WEB/sthyCms/;
        }
		
	location ^~/econnect/ {
		alias D:/sunseaaiot/econnect/code/WEB/econnect/;
        }
		
	location ^~/cmgate/ {
		alias D:/sunseaaiot/cmgate/code/web/cmgate/;
		}
		
	location ^~/bigScreen/ {
		alias E:/rhwl/smartcity/WEB/bigScreen/;
		}
	
	location ^~/pp/ {
		alias D:/sunseaaiot/econnect/code/WEB/panParkScreen/;
	}
	
	location ^~/bs/ {
		alias D:/sunseaaiot/econnect/code/WEB/bigScreen/;
	}
	
	location ^~/sp/ {
		alias D:/sunseaaiot/econnect/code/WEB/securityParkScreen/;
	}
	
	location ^~/fp/ {
		alias D:/sunseaaiot/econnect/code/WEB/fireParkScreen/;
	}
	
	location ^~/sx/ {
		alias D:/sunseaaiot/aiotsmartcity/WEB/sxCms/;
	}
	
		
	location ^~/cms/ {
		alias D:/smartcity/cms/;
		}

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


       server {
        listen       80;
        server_name  dev.backend.cn;

        location / {
	   client_max_body_size  20m;
           proxy_send_timeout 30;
           proxy_read_timeout 30;
           proxy_set_header X-Forwarded-Host $host;
           proxy_set_header X-Forwarded-Server $host;
           proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
           proxy_pass http://back-end;
         }

       location /view {
       root D:/miquan/wechar;
       }

      location /static {
      root D:/miquan/wechar;
      }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }


}