Http

upstream message {
  server localhost:8080 max_fails=3;
}

server {
	listen       80;
	server_name  localhost;

	location / {
		root   html;
		index  index.html index.htm;
		#允许cros跨域访问 
		add_header 'Access-Control-Allow-Origin' '*';
		#proxy_redirect default;
		#跟代理服务器连接的超时时间,必须留意这个time out时间不能超过75秒,当一台服务器当掉时,过10秒转发到另外一台服务器。
		proxy_connect_timeout 10;
	}
	
	 location /message {
	   proxy_pass                  <http://message>;
	   proxy_set_header Host $host:$server_port;
	}
}

Https

upstream message {
  server localhost:8080 max_fails=3;
}

server {
	listen       443 ssl;
	server_name localhost;
	ssl_certificate    /usr/local/nginx-1.17.8/conf/keys/binghe.pem;
	ssl_certificate_key /usr/local/nginx-1.17.8/conf/keys/binghe.key;
	ssl_session_timeout 20m;
	ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
	ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
	ssl_prefer_server_ciphers on;
	ssl_verify_client off;
	location / {
		root   html;
		index  index.html index.htm;
		#允许cros跨域访问 
		add_header 'Access-Control-Allow-Origin' '*';
		#跟代理服务器连接的超时时间,必须留意这个time out时间不能超过75秒,当一台服务器当掉时,过10秒转发到另外一台服务器。
		proxy_connect_timeout 10;
	}
	
	 location /message {
	   proxy_pass                  <http://message>;
	   proxy_set_header Host $host:$server_port;
	}
}