Nginx反代HTTPS出现502

配置里把SSL证书验证关掉
proxy_ssl_verify off;
向服务器传递域名信息。
proxy_ssl_server_name on;
可以正常访问

location / {
	if ($request_method = OPTIONS) {
		add_header Access-Control-Allow-Origin *;
		add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,OPTIONS;
		return 204;
	}
	resolver 114.114.114.114 8.8.8.8;
	proxy_ssl_server_name on;
	proxy_pass $scheme://$host:8$server_port$request_uri;
	proxy_ssl_verify off;
	proxy_set_header X-Real-IP $remote_addr;
	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	proxy_set_header Upgrade $http_upgrade;
	proxy_set_header Connection $connection_upgrade;
	client_max_body_size 1m;
}
点赞