NGINX作为tomcat6的负载均衡器只给出错误的网关错误HTTPS模式

我使用nginx作为tomcat6 webserver上的负载平衡器。 NGINX和TOMCAT6都被configuration为使用HTTPS 。 在以下两个文件中提到了NGINXconfiguration设置。

nginx.conf

user www-data; worker_processes 4; pid /var/run/nginx.pid; events { worker_connections 768; # multi_accept on; } http { ## # Basic Settings ## sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; # server_tokens off; # server_names_hash_bucket_size 64; # server_name_in_redirect off; include /etc/nginx/mime.types; default_type application/octet-stream; ## # Logging Settings ## access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; ## # Gzip Settings ## gzip on; gzip_disable "msie6"; # gzip_vary on; # gzip_proxied any; # gzip_comp_level 6; # gzip_buffers 16 8k; # gzip_http_version 1.1; # gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; ## # nginx-naxsi config ## # Uncomment it if you installed nginx-naxsi user www-data; worker_processes 4; pid /var/run/nginx.pid; events { worker_connections 768; # multi_accept on; } http { ## # Basic Settings ## sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; # server_tokens off; # server_names_hash_bucket_size 64; # server_name_in_redirect off; include /etc/nginx/mime.types; default_type application/octet-stream; ## # Logging Settings ## access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; ## # Gzip Settings ## gzip on; gzip_disable "msie6"; # gzip_vary on; # gzip_proxied any; # gzip_comp_level 6; # gzip_buffers 16 8k; # gzip_http_version 1.1; # gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; ## # nginx-naxsi config ## # Uncomment it if you installed nginx-naxsi #passenger_root /usr; #passenger_ruby /usr/bin/ruby; ## # Virtual Host Configs ## include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; } 

而站点可用/默认如下

 upstream backend { server 10.1.2.4; } server { #HTTPS_ENABLED listen 443 ssl; ssl_certificate %SSL_CERT%; ssl_certificate_key %SSL_KEY%; ssl_ciphers ALL:!ADH:!kEDH:!SSLv2:!EXPORT40:!EXP:!LOW; ssl_session_cache shared:SSL:10m; ssl_session_timeout 10m; #HTTPS_ENABLED location / { proxy_pass https://backend; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } 

如果我使用https链接直接连接networking服务器,则可以访问networking应用程序

1)tomcat启动并正在443上运行

2)没有任何可疑的访问日志

但如果我使用nginxurl(https),它给我“502坏网关”的错误。 我在nginx的access.log和error.log中都找不到任何错误或可疑警告。 这里有什么可能是错的? 请帮忙

尝试这个:

 upstream backend { server 10.1.2.4:443; } 

编辑:只是要完成,我认为这也是另一个解决scheme:

 upstream backend { server 10.1.2.4 ssl; }