#YouHong Tech

worker_processes  1;

events {
    worker_connections  1024;
}
  #gzip
  #    gzip  on;
  #        gzip_static always;
  #            gzip_min_length 1k;
  #                gzip_comp_level 5;
  #                    gzip_types text/plain application/javascript application/x-javascript text/css text/javascript image/jpeg image/gif image/png image/tiff;
  #                        gzip_vary on;
  #
  #                            #files
  
http {
   include mime.types;
    include       mime.types;
    default_type  application/octet-stream; 
    server {
        listen       8099;
        server_name  localhost;
	 client_max_body_size 500m;
	add_header Access-Control-Allow-Origin *;
	add_header Access-Control-Allow-Credentials true;
    	add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
    	add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';

		
	location / {
       #root /home/upgrade;
        proxy_pass http://localhost:3000;
        #proxy Setting
        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;
        proxy_connect_timeout   60s;
        proxy_read_timeout      600s;
        proxy_send_timeout      600s;
    } 

      location /prod-api {
        if ($request_method = 'OPTIONS') {
              add_header 'Access-Control-Allow-Origin' '*';
              add_header 'Access-Control-Allow-Headers' 'Authorization,DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Origin,version';
              add_header 'Access-Control-Max-Age' 1728000;
              add_header 'Access-Control-Allow-Credentials' 'true';
              #add_header 'Content-Type' 'text/plain; charset=utf-8';
              add_header 'Content-Length' 0;
             return 204;
          }
        rewrite /prod-api/(.+)$ /$1 break;
        proxy_pass http://127.0.0.1:8005;

        #proxy Setting
        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;
        proxy_connect_timeout   60s;
        proxy_read_timeout      600s;
        proxy_send_timeout      600s;
    }

    
    location /api/v1 {
        rewrite /api/v1/(.+)$ /$1 break;
        proxy_pass http://localhost:8010;
        #proxy Setting
        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;
        proxy_connect_timeout   60s;
        proxy_read_timeout      600s;
        proxy_send_timeout      600s;
    }
    location /api {
        rewrite /api/(.+)$ /$1 break;
        proxy_pass http://localhost:8010;
        #proxy Setting
        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;
        proxy_connect_timeout   60s;
        proxy_read_timeout      600s;
        proxy_send_timeout      600s;
    }
	}
	server {
        listen 8888;
        server_name localhost;
    	add_header Access-Control-Allow-Origin *;
    	add_header Access-Control-Allow-Credentials true;
        	add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
        	add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';

        client_max_body_size 1000m;

        location / {
    	    root /opt/tool/mcadmin;
        }
	  location /api {
        rewrite /api/(.+)$ /$1 break;
        proxy_pass http://localhost:8010;
        #proxy Setting
          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;
                                                proxy_connect_timeout   60s;
                                                        proxy_read_timeout      600s;
                                                                proxy_send_timeout      600s;
                                                                    }
       
        location /api/v1 {
            rewrite /api/v1/(.+)$ /$1 break;
            proxy_pass  http://localhost:8010;

            #proxy Setting
            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;
            proxy_connect_timeout   60s;
            proxy_read_timeout      600s;
            proxy_send_timeout      600s;


      }
    }



}
