user  root;
worker_processes  8;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  10240;
}


http {

    include       mime.types;
    default_type  application/octet-stream;
    underscores_in_headers on;
        client_max_body_size 100m;

    server {
        listen       80;
        server_name localhost www.aizilai.com;
		underscores_in_headers on;
        location / {
            	root /home/ems/client/zilai;
		index index.html index.htm;
        }

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

    }
    
    
    server {
        listen       80;
        server_name api.growup365.com;
	    underscores_in_headers on;
       
       	location /user/server {
			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_pass   http://172.17.25.13:9500/user/server/;
		}
      	location /employment/server {
			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_pass   http://172.17.25.8:9550/employment/server;
		}
      	location /enterprise/server {
			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_pass   http://172.17.25.8:9540/enterprise/server;
		}

		location /platform/server {
			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_pass   http://172.17.25.13:9530/platform/server;
		}

		location /base/server {
			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_pass   http://172.17.25.13:9502/base/server;
		}
                
		location /school/server {
			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_pass   http://172.17.25.8:9501/school/server;
		}

    }

	server {
        listen	80;
        server_name *.growup365.com;
		underscores_in_headers on;
	
		location / {
			root /home/ems/client/school/portal;
			index index.html index.htm;
			add_header Cache-Control no-cache;
			try_files $uri $uri/ /index.html;
		}

		location /user/server {
			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_pass   http://172.17.25.13:9500/user/server/;
		}
  		location /employment/server {
			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_pass   http://172.17.25.8:9550/employment/server;
		}
  		location /enterprise/server {
			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_pass   http://172.17.25.8:9540/enterprise/server;
		}

      	location /platform/server {
			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_pass   http://172.17.25.13:9530/platform/server;
		}

      	location /base/server {
			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_pass   http://172.17.25.13:9502/base/server;
		}
            
		location /school/server {
			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_pass   http://172.17.25.8:9501/school/server;
		}

    }

	server {
        listen	80;
        server_name *.fa.growup365.com;
		underscores_in_headers on;
	
		location / {
			root /home/ems/client/school/fa;
			index index.html index.htm;
			add_header Cache-Control no-cache;
			try_files $uri $uri/ /index.html;
		}

		location /user/server {
			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_pass   http://172.17.25.13:9500/user/server/;
		}
  		location /employment/server {
			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_pass   http://172.17.25.8:9550/employment/server;
		}
  		location /enterprise/server {
			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_pass   http://172.17.25.8:9540/enterprise/server;
		}

      	location /platform/server {
			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_pass   http://172.17.25.13:9530/platform/server;
		}

      	location /base/server {
			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_pass   http://172.17.25.13:9502/base/server;
		}
            
		location /school/server {
			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_pass   http://172.17.25.8:9501/school/server;
		}

    }
    
    server {
        listen	80;
        server_name get.growup365.com;
		underscores_in_headers on;
		
		location / {
			root /home/ems/client/enterprise-client;
			index index.html index.htm;
			add_header Cache-Control no-cache;
			try_files $uri $uri/ /account.html;
		}

		location /app {
			root /home/ems/client/enterprise-client;
			index enterprise.html enterprise.htm;
			add_header Cache-Control no-cache;
			try_files $uri $uri/ /enterprise.html;
		}

		location /user/server {
			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_pass   http://172.17.25.13:9500/user/server/;
		}
		location /employment/server {
			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_pass   http://172.17.25.8:9550/employment/server;
		}
		location /enterprise/server {
			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_pass   http://172.17.25.8:9540/enterprise/server;
		}

		location /platform/server {
			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_pass   http://172.17.25.13:9530/platform/server;
		}

		location /base/server {
			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_pass   http://172.17.25.13:9502/base/server;
		}

    }

	server {
        listen	80;
        server_name pt.m.growup365.com;
		underscores_in_headers on;
	
		location / {
				root /home/ems/client/platform;
			index index.html index.htm;
		}

		location /platform-api {
			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_pass   http://eduservers/platform-api;
        }
    }

    server {
        listen	80;
        server_name static.growup365.com;
		underscores_in_headers on;
	
		location / {
            root /home/ems/client/static/;
            autoindex on;
		}
    }

   	proxy_buffer_size 128k;
    proxy_buffers 32 128k;
    proxy_busy_buffers_size 128k;

    upstream eduservers{  
        server 172.17.25.14:8003; 
        server 172.17.25.3:8003;
    }
    	
    server {
	
		listen   443 ssl;
		server_name wx.growup365.com;
        ssl_certificate        /home/edu/ssl/wx.growup365.com.crt;
        ssl_certificate_key    /home/edu/ssl/wx.growup365.com.key;
        ssl_session_timeout 5m;
        #ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4:!DH:!DHE;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers on;
        underscores_in_headers on;

    	location /student-api {
	    	proxy_pass http://eduservers/student-api;
            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_set_header X-Forwarded-Proto https;
            proxy_next_upstream off;

            proxy_connect_timeout 30;
            proxy_read_timeout 300;
            proxy_send_timeout 300;

        }

    	location ^~ /TcCfS7yahH/ {
			root /home/edu/resources;	
		}

		location /51Job  {
			proxy_redirect off;
			proxy_set_header Host m.zhaopin.com;
			proxy_set_header X-Real-IP $remote_addr;
			proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
			proxy_set_header X-Forwarded-Proto $scheme;
			proxy_set_header X-Forwarded-Port $server_port;
			proxy_set_header Accept-Encoding "";
			proxy_pass https://m.zhaopin.com/jobs;
		}

		location /4QbVtADbnLVIc  {
			proxy_redirect off;
			proxy_set_header Host m.zhaopin.com;
			proxy_set_header X-Real-IP $remote_addr;
			proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
			proxy_set_header X-Forwarded-Proto $scheme;
			proxy_set_header X-Forwarded-Port $server_port;
			proxy_set_header Accept-Encoding "";
			proxy_pass https://m.zhaopin.com;
		}

    }
	
}
